Part Number Hot Search : 
UGF3JB RPC2440 UGF3JB C3506 L29S800F 74LV1G ND1391 B80C800
Product Description
Full Text Search
 

To Download HD64F7052 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  regarding the change of names mentioned in the document, such as hitachi electric and hitachi xx, to renesas technology corp. the semiconductor operations of mitsubishi electric and hitachi were transferred to renesas technology corporation on april 1st 2003. these operations include microcomputer, logic, analog and discrete devices, and memory chips other than drams (flash memory, srams etc.) accordingly, although hitachi, hitachi, ltd., hitachi semiconductors, and other hitachi brand names are mentioned in the document, these names have in fact all been changed to renesas technology corp. thank you for your understanding. except for our corporate trademark, logo and corporate statement, no changes whatsoever have been made to the contents of the document, and these changes do not constitute any alteration to the contents of the document itself. renesas technology home page: http://www.renesas.com renesas technology corp. customer support dept. april 1, 2003 to all our customers
cautions keep safety first in your circuit designs! 1. renesas technology corporation puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. notes regarding these materials 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corporation product best suited to the customer's application; they do not convey any license under any intellectual property rights, or an y other rights, belonging to renesas technology corporation or a third party. 2. renesas technology corporation assumes no responsibility for any damage, or infringement of any third-party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained i n these materials. 3. all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corporation without notice due to product improvements or other reasons. it is therefore recommended that customers contact renesas technology corporation or an authorized renesas technology corporation product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology corporation assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corporation by various means, including the renesas technology corporation semiconductor home page (http://www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, an d algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. renesas technology corporation assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. 5. renesas technology corporation semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact renesas technology corporation or an authorized renesas technology corporation product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. 6. the prior written approval of renesas technology corporation is necessary to reprint or reproduce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a lice nse from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. 8. please contact renesas technology corporation for further details on these materials or the products contained therein.
hitachi superh tm risc engine sh-2 sh7052 f-ztat sh7053 f-ztat sh7054 f-ztat hardware manual ade-602-185b rev. 3.0 3/3/03 hitachi, ltd.
cautions 1. hitachi neither warrants nor grants licenses of any rights of hitachi? or any third party? patent, copyright, trademark, or other intellectual property rights for information contained in this document. hitachi bears no responsibility for problems that may arise with third party? rights, including intellectual property rights, in connection with use of the information contained in this document. 2. products and product specifications may be subject to change without notice. confirm that you have received the latest product standards or specifications before final design, purchase or use. 3. hitachi makes every attempt to ensure that its products are of high quality and reliability. however, contact hitachi? sales office before using the product in an application that demands especially high quality and reliability or where its failure or malfunction may directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear power, combustion control, transportation, traffic, safety equipment or medical equipment for life support. 4. design your application so that the product is used within the ranges guaranteed by hitachi particularly for maximum rating, operating supply voltage range, heat radiation characteristics, installation conditions and other characteristics. hitachi bears no responsibility for failure or damage when used beyond the guaranteed ranges. even within the guaranteed ranges, consider normally foreseeable failure rates or failure modes in semiconductor devices and employ systemic measures such as fail-safes, so that the equipment incorporating hitachi product does not cause bodily injury, fire or other consequential damage due to operation of the hitachi product. 5. this product is not designed to be radiation resistant. 6. no one is permitted to reproduce or duplicate, in any form, the whole or part of this document without written approval from hitachi. 7. contact hitachi? sales office for any questions regarding this document or hitachi semiconductor products.
preface the sh7052f/sh7053f/sh7054f is a single-chip risc (reduced instruction set computer) microcomputer that has an original hitachi risc type cpu as its core, and also includes peripheral functions necessary for system configuration. the cpu of the sh7052f/sh7053f/sh7054f has a risc type instruction set, with basic instructions executed in one system clock cycle, for a higher instruction execution speed. it employs an internal 32-bit configuration, and offers enhanced data processing performance. the cpu of the sh7052f/sh7053f/sh7054f makes it possible to create high-performance, high- functionality systems at low cost, even for applications requiring high speed such as real-time control, which could not be realized with conventional microcomputers. the sh7052f/sh7053f/sh7054f is also equipped with on-chip peripheral functions necessary for system configuration, including large-capacity rom and ram, a direct memory access controller (dmac), timers, a serial communication interface (sci), hitachi controller area network (hcan), a/d converter, interrupt controller (intc), and i/o ports. in addition, an external memory access support function allows direct connection of rom and sram, enabling system costs to be greatly reduced. the sh7052f/sh7053f/sh7054f is an f-ztat (flexible zero turn-around time) version with flash memory as its on-chip rom. flash memory programs can be written with a programmer that supports sh7052f/sh7053f/sh7054f programming, and the flash memory can also be programmed and erased by software. this allows reprogramming to be carried out by the user with the chip mounted on a board. this hardware manual describes the hardware of the sh7052f/sh7053f/sh7054f. details of instructions can be found in the programming manual. related manual covering sh7052f/sh7053f/sh7054f execution instructions: sh-1/sh-2/sh-dsp programming manual please consult your hitachi sales representative for details of the development environment system.

main revisions and additions in this edition page item revisions (see manual for details) 8 1.3.1 pin arrangement name of 155 th pin amended (pk11/to8l) 61 5.1.1 types of exception processing and priority table 5.1 types of exception processing and priority order compare match timer (cmt1), a/d converter channel 1 (a/d1) added module abbreviations amended: cmt0, a/d0 160 9.3.5 dual address mode figure 9.5 dual address mode and indirect address operation (16-bit-width external memory space) description of 1st and 2nd bus cycles amended if the data bus is 16 bits wide when the external memory space is accessed, two bus cycles are necessary. 217 10.2.3 timer control registers (tcr) timer control register 9a, 9b, 9c (tcr9a, tcr9b, tcr9c) description of bits 1 and 0 amended x=a, c, or e 306 10.2.15 free-running counters (tcnt) description of free-running counter 0 added when the bits corresponding to the timer start register 1 (tstr1) are set to 1, this counter starts to count. 307 description of free-running counters 1a, 1b, 2a, 2b, 3, 4, 5, 11 added when the bits corresponding to the timer start register 1, 3 (tstr1, tstr3) are set to 1, these counters start to count. 335 10.3.1 overview description of channel 2 amended 337 description of channel 10 amended 348 10.3.9 pwm timer function description amended ..., and h'0002, h'0003, h'0004 (100%), and h'0000 (0%) in bfr6a. 375 10.6 sample setup procedures sample setup procedure for channel 0 input capture triggered by channel 10 compare-match register name amended 399 writing to rom area immediately after atu register write description added
page item revisions (see manual for details) 400, 401 10.8 atu-ii registers and pins table 10.4 atu-ii registers and pins register names amended pin names added and deleted 435 13.4.2 compare match flag set timing figure 13.4 cmf set timing cmcnt timing waveform amended 435 13.4.3 compare match flag clear timing description deleted 445 14.2.5 serial mode register (smr) description amended 448 14.2.6 serial control register (scr) description amended 456 14.2.8 bit rate register (brr) description amended 463 14.2.9 serial direction control register (sdcr) description amended 497 14.5.3 break detection and processing 14.5.4 sending a break signal description added (asynchronous mode only) 504 table 15.2 hcan registers rfpr register name amended imr initial value amended 510 15.2.3 bit configuration register (bcr) bcr setting constraints amended table note added 517 15.2.11 interrupt register (irr) initial value of bits 10 and 9 amended 519 description of bit 9 amended 520 description of bit 8 amended 533 15.3.1 hardware reset and software reset description of hardware reset amended 537 table 15.4 bcr setting limits description amended 541 figure 15.7 transmission flowchart description amended 548 figure 15.9 reception flowchart description amended 552 figure 15.11 hcan sleep mode flowchart description amended 554 figure 15.12 hcan halt mode flowchart description amended 560 16.1.1 features description deleted
page item revisions (see manual for details) 562 16.1.3 pin configuration description amended 570 16.2.3 a/d control registers 0 and 1 (adcr0, adcr1) description amended 585 16.4.4 external triggering of a/d converter description amended 600 17.5.3 rom area writes new description added 701 20.5.5 ram emulation register (ramer) description of bits 15 to 4 added the write value should always be 0. 713 20.7.3 erase mode description amended 722 20.10 note on flash memory programming/erasing description added 763 21.7.3 erase mode description amended 797 23.3.1 transition to hardware standby mode description added 815 to 819 24.2 dc characteristics table 24.4 dc characteristics description amended 837 24.3.9 hcan timing table 24.14 hcan timing description amended 840 24.3.11 aud timing table 24.16 aud timing load conditions added 863, 867 appendix a.1 address table a.1 address register abbreviations amended: h?ffff466, h?ffff526 881, 884 to 886 a.2 register states in reset and power-down states table a.2 register states in reset and power-down states description amended 891 appendix d package dimensions figure d.1 package dimensions (fp-208a) amended

i contents section 1 overview ........................................................................................................... 1 1.1 features................................................................................................................... ........... 1 1.2 block diagram.............................................................................................................. ..... 7 1.3 pin description ............................................................................................................ ...... 8 1.3.1 pin arrangement .................................................................................................. 8 1.3.2 pin functions........................................................................................................ 9 1.3.3 pin assignments ................................................................................................... 16 section 2 cpu ..................................................................................................................... 23 2.1 register configuration ..................................................................................................... .23 2.1.1 general registers (rn) ......................................................................................... 23 2.1.2 control registers.................................................................................................. 24 2.1.3 system registers .................................................................................................. 25 2.1.4 initial values of registers .................................................................................... 25 2.2 data formats............................................................................................................... ....... 26 2.2.1 data format in registers...................................................................................... 26 2.2.2 data format in memory ....................................................................................... 26 2.2.3 immediate data format........................................................................................ 26 2.3 instruction features ....................................................................................................... .... 27 2.3.1 risc-type instruction set ................................................................................... 27 2.3.2 addressing modes................................................................................................ 30 2.3.3 instruction format ................................................................................................ 34 2.4 instruction set by classification........................................................................................ 37 2.5 processing states .......................................................................................................... ..... 50 2.5.1 state transitions ................................................................................................... 50 section 3 operating modes ............................................................................................ 53 3.1 operating mode selection ................................................................................................. 53 section 4 clock pulse generator (cpg) ..................................................................... 55 4.1 overview................................................................................................................... ......... 55 4.1.1 block diagram...................................................................................................... 55 4.1.2 pin configuration ................................................................................................. 56 4.2 frequency ranges........................................................................................................... ... 56 4.3 clock source............................................................................................................... ....... 57 4.3.1 connecting a crystal oscillator............................................................................ 57 4.3.2 external clock input method ............................................................................... 58 4.4 usage notes ................................................................................................................ ....... 59
ii section 5 exception processing .................................................................................... 61 5.1 overview................................................................................................................... ......... 61 5.1.1 types of exception processing and priority ........................................................ 61 5.1.2 exception processing operations ......................................................................... 62 5.1.3 exception processing vector table...................................................................... 63 5.2 resets..................................................................................................................... ............ 65 5.2.1 types of reset ...................................................................................................... 65 5.2.2 power-on reset.................................................................................................... 65 5.2.3 manual reset........................................................................................................ 66 5.3 address errors ............................................................................................................. ...... 67 5.3.1 address error sources.......................................................................................... 67 5.3.2 address error exception processing.................................................................... 68 5.4 interrupts................................................................................................................. ........... 68 5.4.1 interrupt sources .................................................................................................. 68 5.4.2 interrupt priority level......................................................................................... 69 5.4.3 interrupt exception processing ............................................................................ 69 5.5 exceptions triggered by instructions................................................................................ 70 5.5.1 types of exceptions triggered by instructions.................................................... 70 5.5.2 trap instructions .................................................................................................. 70 5.5.3 illegal slot instructions ........................................................................................ 71 5.5.4 general illegal instructions .................................................................................. 71 5.6 when exception sources are not accepted..................................................................... 72 5.7 stack status after exception processing ends................................................................... 73 5.8 usage notes ................................................................................................................ ....... 74 5.8.1 value of stack pointer (sp).................................................................................. 74 5.8.2 value of vector base register (vbr) ................................................................. 74 5.8.3 address errors caused by stacking of address error exception processing...... 74 section 6 interrupt controller (intc) ......................................................................... 75 6.1 overview................................................................................................................... ......... 75 6.1.1 features ................................................................................................................ 7 5 6.1.2 block diagram...................................................................................................... 76 6.1.3 pin configuration ................................................................................................. 77 6.1.4 register configuration ......................................................................................... 77 6.2 interrupt sources.......................................................................................................... ...... 78 6.2.1 nmi interrupts...................................................................................................... 78 6.2.2 user break interrupt ............................................................................................. 78 6.2.3 irq interrupts ...................................................................................................... 78 6.2.4 on-chip peripheral module interrupts ................................................................ 79 6.2.5 interrupt exception vectors and priority rankings ............................................. 79 6.3 description of registers ................................................................................................... .88 6.3.1 interrupt priority registers a, c to l (ipra, iprc to iprl) ............................. 88 6.3.2 interrupt control register (icr) .......................................................................... 89
iii 6.3.3 irq status register (isr) .................................................................................... 90 6.4 interrupt operation ........................................................................................................ .... 92 6.4.1 interrupt sequence................................................................................................ 92 6.4.2 stack after interrupt exception processing .......................................................... 94 6.5 interrupt response time ................................................................................................... 9 5 6.6 data transfer with interrupt request signals ................................................................... 97 6.6.1 handling cpu interrupt sources, but not dmac activating sources ............... 97 6.6.2 handling dmac activating sources but not cpu interrupt sources ................ 97 section 7 user break controller (ubc) ..................................................................... 99 7.1 overview................................................................................................................... ......... 99 7.1.1 features ................................................................................................................ 9 9 7.1.2 block diagram...................................................................................................... 100 7.1.3 register configuration ......................................................................................... 101 7.2 register descriptions...................................................................................................... ... 101 7.2.1 user break address register (ubar)................................................................. 101 7.2.2 user break address mask register (ubamr) ................................................... 102 7.2.3 user break bus cycle register (ubbr) ............................................................. 104 7.2.4 user break control register (ubcr).................................................................. 106 7.3 operation .................................................................................................................. ......... 107 7.3.1 flow of the user break operation........................................................................ 107 7.3.2 break on on-chip memory instruction fetch cycle ........................................... 109 7.3.3 program counter (pc) values saved ................................................................... 109 7.4 examples of use............................................................................................................ .... 110 7.4.1 break on cpu instruction fetch cycle ................................................................ 110 7.4.2 break on cpu data access cycle........................................................................ 111 7.4.3 break on dma cycle........................................................................................... 111 7.5 usage notes ................................................................................................................ ....... 112 7.5.1 simultaneous fetching of two instructions......................................................... 112 7.5.2 instruction fetch at branches ............................................................................... 112 7.5.3 contention between user break and exception processing ................................ 113 7.5.4 break at non-delay branch instruction jump destination.................................. 113 7.5.5 user break trigger output................................................................................... 113 7.5.6 module standby.................................................................................................... 114 section 8 bus state controller (bsc) ......................................................................... 115 8.1 overview................................................................................................................... ......... 115 8.1.1 features ................................................................................................................ 1 15 8.1.2 block diagram...................................................................................................... 116 8.1.3 pin configuration ................................................................................................. 117 8.1.4 register configuration ......................................................................................... 117 8.1.5 address map ........................................................................................................ 118 8.2 description of registers ................................................................................................... . 122
iv 8.2.1 bus control register 1 (bcr1)............................................................................ 122 8.2.2 bus control register 2 (bcr2)............................................................................ 123 8.2.3 wait control register (wcr).............................................................................. 126 8.2.4 ram emulation register (ramer) ................................................................... 128 8.3 accessing external space.................................................................................................. 1 30 8.3.1 basic timing ........................................................................................................ 130 8.3.2 wait state control ................................................................................................ 131 8.3.3 cs assert period extension.................................................................................. 133 8.4 waits between access cycles ........................................................................................... 134 8.4.1 prevention of data bus conflicts ......................................................................... 134 8.4.2 simplification of bus cycle start detection ........................................................ 135 8.5 bus arbitration ............................................................................................................ ...... 136 8.6 memory connection examples ......................................................................................... 137 section 9 direct memory access controller (dmac) .......................................... 139 9.1 overview................................................................................................................... ......... 139 9.1.1 features ................................................................................................................ 1 39 9.1.2 block diagram...................................................................................................... 140 9.1.3 register configuration ......................................................................................... 141 9.2 register descriptions...................................................................................................... ... 142 9.2.1 dma source address registers 0 to 3 (sar0 to sar3) .................................... 142 9.2.2 dma destination address registers 0 to 3 (dar0 to dar3)............................ 143 9.2.3 dma transfer count registers 0 to 3 (dmatcr0 to dmatcr3) .................. 144 9.2.4 dma channel control registers 0 to 3 (chcr0 to chcr3) ............................ 145 9.2.5 dmac operation register (dmaor) ................................................................ 150 9.3 operation .................................................................................................................. ......... 152 9.3.1 dma transfer flow ............................................................................................. 152 9.3.2 dma transfer requests....................................................................................... 154 9.3.3 channel priority.................................................................................................... 157 9.3.4 dma transfer types ........................................................................................... 157 9.3.5 dual address mode.............................................................................................. 157 9.3.6 bus modes............................................................................................................ 163 9.3.7 relationship between request modes and bus modes by dma transfer category ............................................................................................................... 164 9.3.8 bus mode and channel priorities......................................................................... 165 9.3.9 source address reload function ......................................................................... 165 9.3.10 dma transfer ending conditions ....................................................................... 166 9.3.11 dmac access from cpu .................................................................................... 167 9.4 examples of use............................................................................................................ .... 168 9.4.1 example of dma transfer between on-chip sci and external memory.......... 168 9.4.2 example of dma transfer between a/d converter and on-chip memory (address reload on) ............................................................................................ 168
v 9.4.3 example of dma transfer between external memory and sci1 transmitting side (indirect address on) ........................................................................................... 170 9.5 usage notes ................................................................................................................ ....... 172 section 10 advanced timer unit-ii (atu-ii) ............................................................ 173 10.1 overview.................................................................................................................. .......... 173 10.1.1 features ................................................................................................................ 173 10.1.2 pin configuration ................................................................................................. 178 10.1.3 register configuration ......................................................................................... 182 10.1.4 block diagrams.................................................................................................... 192 10.1.5 inter-channel and inter-module signal communication diagram...................... 202 10.1.6 prescaler diagram ................................................................................................ 203 10.2 register descriptions..................................................................................................... .... 204 10.2.1 timer start registers (tstr) .............................................................................. 204 10.2.2 prescaler registers (pscr) .................................................................................. 208 10.2.3 timer control registers (tcr)............................................................................ 209 10.2.4 timer i/o control registers (tior).................................................................... 219 10.2.5 timer status registers (tsr) .............................................................................. 231 10.2.6 timer interrupt enable registers (tier)............................................................. 260 10.2.7 interval interrupt request registers (itvrr) ..................................................... 282 10.2.8 trigger mode register (trgmdr) .................................................................... 286 10.2.9 timer mode register (tmdr) ............................................................................ 286 10.2.10 pwm mode register (pmdr)............................................................................. 288 10.2.11 down-count start register (dstr) .................................................................... 290 10.2.12 timer connection register (tcnr) .................................................................... 296 10.2.13 one-shot pulse terminate register (otr).......................................................... 301 10.2.14 reload enable register (rldenr) .................................................................... 305 10.2.15 free-running counters (tcnt) .......................................................................... 306 10.2.16 down-counters (dcnt)...................................................................................... 308 10.2.17 event counters (ecnt) ....................................................................................... 309 10.2.18 output compare registers (ocr)........................................................................ 310 10.2.19 input capture registers (icr).............................................................................. 311 10.2.20 general registers (gr) ........................................................................................ 312 10.2.21 offset base registers (osbr) ............................................................................. 314 10.2.22 cycle registers (cylr) ...................................................................................... 315 10.2.23 buffer registers (bfr) ........................................................................................ 316 10.2.24 duty registers (dtr) .......................................................................................... 317 10.2.25 reload register (rldr) ...................................................................................... 318 10.2.26 channel 10 registers............................................................................................ 318 10.3 operation ................................................................................................................. .......... 333 10.3.1 overview .............................................................................................................. 33 3 10.3.2 free-running counter operation and cyclic counter operation........................ 339 10.3.3 compare-match function .................................................................................... 341
vi 10.3.4 input capture function......................................................................................... 342 10.3.5 one-shot pulse function...................................................................................... 343 10.3.6 offset one-shot pulse function and output cutoff function ............................. 344 10.3.7 interval timer operation...................................................................................... 345 10.3.8 twin-capture function ........................................................................................ 346 10.3.9 pwm timer function .......................................................................................... 347 10.3.10 channel 3 to 5 pwm function............................................................................. 349 10.3.11 event count function and event cycle measurement......................................... 350 10.3.12 channel 10 functions ........................................................................................... 352 10.4 interrupts................................................................................................................ ............ 360 10.4.1 status flag setting timing ................................................................................... 360 10.4.2 status flag clearing ............................................................................................. 365 10.5 cpu interface ............................................................................................................. ....... 367 10.5.1 registers requiring 32-bit access ...................................................................... 367 10.5.2 registers permitting 8-bit, 16-bit, or 32-bit access ........................................... 369 10.5.3 registers requiring 16-bit access ...................................................................... 370 10.5.4 8-bit or 16-bit accessible registers .................................................................... 371 10.5.5 registers requiring 8-bit access ........................................................................ 372 10.6 sample setup procedures .................................................................................................. 3 72 10.7 usage notes ............................................................................................................... ........ 387 10.8 atu-ii registers and pins ............................................................................................... 40 0 section 11 advanced pulse controller (apc) ............................................................ 403 11.1 overview.................................................................................................................. .......... 403 11.1.1 features ................................................................................................................ 403 11.1.2 block diagram...................................................................................................... 404 11.1.3 pin configuration ................................................................................................. 405 11.1.4 register configuration ......................................................................................... 405 11.2 register descriptions..................................................................................................... .... 406 11.2.1 pulse output port control register (popcr)...................................................... 406 11.3 operation ................................................................................................................. .......... 407 11.3.1 overview .............................................................................................................. 40 7 11.3.2 advanced pulse controller output operation...................................................... 408 11.4 usage notes ............................................................................................................... ........ 411 section 12 watchdog timer (wdt) .............................................................................. 413 12.1 overview.................................................................................................................. .......... 413 12.1.1 features ................................................................................................................ 413 12.1.2 block diagram...................................................................................................... 414 12.1.3 pin configuration ................................................................................................. 414 12.1.4 register configuration ......................................................................................... 415 12.2 register descriptions..................................................................................................... .... 415 12.2.1 timer counter (tcnt) ........................................................................................ 415
vii 12.2.2 timer control/status register (tcsr) ................................................................ 416 12.2.3 reset control/status register (rstcsr) ............................................................ 418 12.2.4 register access .................................................................................................... 419 12.3 operation ................................................................................................................. .......... 420 12.3.1 watchdog timer mode ........................................................................................ 420 12.3.2 interval timer mode ............................................................................................ 422 12.3.3 clearing software standby mode ........................................................................ 422 12.3.4 timing of setting the overflow flag (ovf)........................................................ 423 12.3.5 timing of setting the watchdog timer overflow flag (wovf)........................ 423 12.4 usage notes ............................................................................................................... ........ 424 12.4.1 tcnt write and increment contention............................................................... 424 12.4.2 changing cks2 to cks0 bit values................................................................... 424 12.4.3 changing between watchdog timer/interval timer modes................................ 424 12.4.4 system reset by wdtovf signal...................................................................... 425 12.4.5 internal reset in watchdog timer mode ............................................................. 425 12.4.6 manual reset in watchdog timer........................................................................ 425 section 13 compare match timer (cmt) ................................................................... 427 13.1 overview.................................................................................................................. .......... 427 13.1.1 features ................................................................................................................ 427 13.1.2 block diagram...................................................................................................... 428 13.1.3 register configuration ......................................................................................... 429 13.2 register descriptions..................................................................................................... .... 430 13.2.1 compare match timer start register (cmstr) ................................................. 430 13.2.2 compare match timer control/status register (cmcsr).................................. 431 13.2.3 compare match timer counter (cmcnt).......................................................... 432 13.2.4 compare match timer constant register (cmcor).......................................... 433 13.3 operation ................................................................................................................. .......... 433 13.3.1 cyclic count operation........................................................................................ 433 13.3.2 cmcnt count timing ........................................................................................ 434 13.4 interrupts................................................................................................................ ............ 434 13.4.1 interrupt sources and dtc activation................................................................. 434 13.4.2 compare match flag set timing ......................................................................... 434 13.4.3 compare match flag clear timing...................................................................... 435 13.5 usage notes ............................................................................................................... ........ 436 13.5.1 contention between cmcnt write and compare match ................................... 436 13.5.2 contention between cmcnt word write and incrementation .......................... 437 13.5.3 contention between cmcnt byte write and incrementation ............................ 438 section 14 serial communication interface (sci) .................................................... 439 14.1 overview.................................................................................................................. .......... 439 14.1.1 features ................................................................................................................ 439 14.1.2 block diagram...................................................................................................... 440
viii 14.1.3 pin configuration ................................................................................................. 441 14.1.4 register configuration ......................................................................................... 442 14.2 register descriptions..................................................................................................... .... 443 14.2.1 receive shift register (rsr)............................................................................... 443 14.2.2 receive data register (rdr) .............................................................................. 444 14.2.3 transmit shift register (tsr).............................................................................. 444 14.2.4 transmit data register (tdr) ............................................................................. 445 14.2.5 serial mode register (smr)................................................................................ 445 14.2.6 serial control register (scr).............................................................................. 448 14.2.7 serial status register (ssr)................................................................................. 452 14.2.8 bit rate register (brr)....................................................................................... 456 14.2.9 serial direction control register (sdcr) ........................................................... 463 14.2.10 inversion of sck pin signal ................................................................................ 464 14.3 operation ................................................................................................................. .......... 464 14.3.1 overview .............................................................................................................. 46 4 14.3.2 operation in asynchronous mode........................................................................ 466 14.3.3 multiprocessor communication ........................................................................... 476 14.3.4 synchronous operation ........................................................................................ 484 14.4 sci interrupt sources and the dmac............................................................................... 495 14.5 usage notes ............................................................................................................... ........ 496 14.5.1 tdr write and tdre flag.................................................................................. 496 14.5.2 simultaneous multiple receive errors ................................................................ 496 14.5.3 break detection and processing (asynchronous mode only)............................. 497 14.5.4 sending a break signal (asynchronous mode only) .......................................... 497 14.5.5 receive error flags and transmitter operation (synchronous mode only)....... 497 14.5.6 receive data sampling timing and receive margin in asynchronous mode.... 497 14.5.7 constraints on dmac use .................................................................................. 499 14.5.8 cautions on synchronous external clock mode.................................................. 499 14.5.9 caution on synchronous internal clock mode .................................................... 499 section 15 hitachi controller area network (hcan) ............................................ 501 15.1 overview.................................................................................................................. .......... 501 15.1.1 features ................................................................................................................ 501 15.1.2 block diagram...................................................................................................... 502 15.1.3 pin configuration ................................................................................................. 503 15.1.4 register configuration ......................................................................................... 504 15.2 register descriptions..................................................................................................... .... 506 15.2.1 master control register (mcr)........................................................................... 506 15.2.2 general status register (gsr)............................................................................. 507 15.2.3 bit configuration register (bcr)........................................................................ 508 15.2.4 mailbox configuration register (mbcr)............................................................ 512 15.2.5 transmit wait register (txpr) .......................................................................... 512 15.2.6 transmit wait cancel register (txcr) .............................................................. 513
ix 15.2.7 transmit acknowledge register (txack) ........................................................ 514 15.2.8 abort acknowledge register (aback).............................................................. 515 15.2.9 receive complete register (rxpr) .................................................................... 516 15.2.10 remote request register (rfpr)........................................................................ 517 15.2.11 interrupt register (irr) ....................................................................................... 517 15.2.12 mailbox interrupt mask register (mbimr)........................................................ 521 15.2.13 interrupt mask register (imr) ............................................................................ 522 15.2.14 receive error counter (rec) .............................................................................. 524 15.2.15 transmit error counter (tec) ............................................................................. 525 15.2.16 unread message status register (umsr) ........................................................... 525 15.2.17 local acceptance filter masks (lafml, lafmh) ........................................... 526 15.2.18 message control (mc0 to mc15)........................................................................ 527 15.2.19 message data (md0 to md15)............................................................................ 531 15.3 operation ................................................................................................................. .......... 533 15.3.1 hardware reset and software reset .................................................................... 533 15.3.2 initialization after a hardware reset.................................................................... 536 15.3.3 transmit mode ..................................................................................................... 539 15.3.4 receive mode....................................................................................................... 546 15.3.5 hcan sleep mode .............................................................................................. 552 15.3.6 hcan halt mode ................................................................................................ 554 15.3.7 interrupt interface................................................................................................. 555 15.3.8 dmac interface................................................................................................... 556 15.4 can bus interface ......................................................................................................... ... 557 15.5 usage notes ............................................................................................................... ........ 558 section 16 a/d converter ................................................................................................. 559 16.1 overview.................................................................................................................. .......... 559 16.1.1 features ................................................................................................................ 559 16.1.2 block diagram...................................................................................................... 561 16.1.3 pin configuration ................................................................................................. 562 16.1.4 register configuration ......................................................................................... 564 16.2 register descriptions..................................................................................................... .... 565 16.2.1 a/d data registers 0 to 15 (addr0 to addr15) ............................................. 565 16.2.2 a/d control/status register 0 (adcsr0)........................................................... 566 16.2.3 a/d control registers 0 and 1 (adcr0, adcr1) ............................................. 570 16.2.4 a/d control/status register 1 (adcsr1)........................................................... 572 16.2.5 a/d trigger registers 0 and 1 (adtrgr0, adtrgr1) ................................... 575 16.3 cpu interface ............................................................................................................. ....... 576 16.4 operation ................................................................................................................. .......... 577 16.4.1 single mode.......................................................................................................... 577 16.4.2 scan mode............................................................................................................ 579 16.4.3 analog input sampling and a/d conversion time ............................................. 583 16.4.4 external triggering of a/d converter ................................................................. 585
x 16.4.5 a/d converter activation by atu-ii .................................................................. 586 16.5 interrupt sources and dma transfer requests ................................................................ 586 16.6 usage notes ............................................................................................................... ........ 586 16.6.1 a/d conversion accuracy definitions ................................................................... 588 section 17 advanced user debugger (aud) ............................................................. 591 17.1 overview.................................................................................................................. .......... 591 17.1.1 features ................................................................................................................ 591 17.1.2 block diagram...................................................................................................... 592 17.2 pin configuration ......................................................................................................... ..... 592 17.2.1 pin descriptions ................................................................................................... 593 17.3 branch trace mode ......................................................................................................... .. 595 17.3.1 overview .............................................................................................................. 59 5 17.3.2 operation .............................................................................................................. 5 95 17.4 ram monitor mode.......................................................................................................... 597 17.4.1 overview .............................................................................................................. 59 7 17.4.2 communication protocol...................................................................................... 597 17.4.3 operation .............................................................................................................. 5 98 17.5 usage notes ............................................................................................................... ........ 599 17.5.1 initialization.......................................................................................................... 599 17.5.2 operation in software standby mode .................................................................. 599 17.5.3 rom area writes ................................................................................................ 600 section 18 pin function controller (pfc) .................................................................... 601 18.1 overview.................................................................................................................. .......... 601 18.2 register configuration .................................................................................................... .. 606 18.3 register descriptions..................................................................................................... .... 607 18.3.1 port a io register (paior) ................................................................................ 607 18.3.2 port a control registers h and l (pacrh, pacrl) ........................................ 607 18.3.3 port b io register (pbior)................................................................................. 612 18.3.4 port b control registers h and l (pbcrh, pbcrl) ......................................... 612 18.3.5 port b invert register (pbir) .............................................................................. 618 18.3.6 port c io register (pcior)................................................................................. 619 18.3.7 port c control register (pccr) .......................................................................... 620 18.3.8 port d io register (pdior) ................................................................................ 622 18.3.9 port d control registers h and l (pdcrh, pdcrl) ........................................ 623 18.3.10 port e io register (peior) ................................................................................. 627 18.3.11 port e control register (pecr)........................................................................... 628 18.3.12 port f io register (pfior).................................................................................. 633 18.3.13 port f control registers h and l (pfcrh, pfcrl) .......................................... 634 18.3.14 port g io register (pgior) ................................................................................ 640 18.3.15 port g control register (pgcr).......................................................................... 641 18.3.16 port h io register (phior) ................................................................................ 643
xi 18.3.17 port h control register (phcr).......................................................................... 644 18.3.18 port j io register (pjior) ................................................................................... 650 18.3.19 port j control registers h and l (pjcrh, pjcrl) ............................................ 651 18.3.20 port k io register (pkior) ................................................................................ 655 18.3.21 port k control registers h and l (pkcrh, pkcrl) ........................................ 656 18.3.22 port k invert register (pkir).............................................................................. 660 section 19 i/o ports (i/o) .................................................................................................. 661 19.1 overview.................................................................................................................. .......... 661 19.2 port a.................................................................................................................... ............. 662 19.2.1 register configuration ......................................................................................... 662 19.2.2 port a data register (padr) .............................................................................. 663 19.3 port b .................................................................................................................... ............. 664 19.3.1 register configuration ......................................................................................... 664 19.3.2 port b data register (pbdr)............................................................................... 665 19.4 port c .................................................................................................................... ............. 666 19.4.1 register configuration ......................................................................................... 666 19.4.2 port c data register (pcdr)............................................................................... 666 19.5 port d.................................................................................................................... ............. 668 19.5.1 register configuration ......................................................................................... 668 19.5.2 port d data register (pddr) .............................................................................. 669 19.6 port e .................................................................................................................... ............. 670 19.6.1 register configuration ......................................................................................... 670 19.6.2 port e data register (pedr) ............................................................................... 671 19.7 port f .................................................................................................................... ............. 673 19.7.1 register configuration ......................................................................................... 673 19.7.2 port f data register (pfdr)................................................................................ 674 19.8 port g.................................................................................................................... ............. 676 19.8.1 register configuration ......................................................................................... 676 19.8.2 port g data register (pgdr) .............................................................................. 676 19.9 port h.................................................................................................................... ............. 678 19.9.1 register configuration ......................................................................................... 679 19.9.2 port h data register (phdr) .............................................................................. 679 19.10 port j................................................................................................................... ............... 681 19.10.1 register configuration ......................................................................................... 681 19.10.2 port j data register (pjdr) ................................................................................. 682 19.11 port k.................................................................................................................... ............. 683 19.11.1 register configuration ......................................................................................... 683 19.11.2 port k data register (pkdr) .............................................................................. 684 19.12 pod (port output disable) control .................................................................................. 685 section 20 rom (sh7052f/sh7053f) ........................................................................ 687 20.1 features.................................................................................................................. ............ 687
xii 20.2 overview.................................................................................................................. .......... 688 20.2.1 block diagram...................................................................................................... 688 20.2.2 mode transitions.................................................................................................. 689 20.2.3 on-board programming modes ........................................................................... 690 20.2.4 flash memory emulation in ram....................................................................... 692 20.2.5 differences between boot mode and user program mode.................................. 693 20.2.6 block configuration ............................................................................................. 694 20.3 pin configuration ......................................................................................................... ..... 694 20.4 register configuration .................................................................................................... .. 695 20.5 register descriptions..................................................................................................... .... 696 20.5.1 flash memory control register 1 (flmcr1)..................................................... 696 20.5.2 flash memory control register 2 (flmcr2)..................................................... 698 20.5.3 erase block register 1 (ebr1)............................................................................ 699 20.5.4 erase block register 2 (ebr2)............................................................................ 699 20.5.5 ram emulation register (ramer) ................................................................... 701 20.6 on-board programming modes ........................................................................................ 703 20.6.1 boot mode............................................................................................................ 703 20.6.2 user program mode ............................................................................................. 708 20.7 programming/erasing flash memory................................................................................ 708 20.7.1 program mode...................................................................................................... 709 20.7.2 program-verify mode .......................................................................................... 710 20.7.3 erase mode........................................................................................................... 713 20.7.4 erase-verify mode ............................................................................................... 714 20.8 protection................................................................................................................ ........... 717 20.8.1 hardware protection............................................................................................. 717 20.8.2 software protection .............................................................................................. 718 20.8.3 error protection .................................................................................................... 718 20.9 flash memory emulation in ram.................................................................................... 720 20.10 note on flash memory programming/erasing.................................................................. 722 20.11 flash memory programmer mode .................................................................................... 722 20.11.1 socket adapter pin correspondence diagram ..................................................... 723 20.11.2 programmer mode operation............................................................................... 725 20.11.3 memory read mode............................................................................................. 726 20.11.4 auto-program mode ............................................................................................ 729 20.11.5 auto-erase mode.................................................................................................. 731 20.11.6 status read mode................................................................................................. 733 20.11.7 status polling........................................................................................................ 7 34 20.11.8 programmer mode transition time..................................................................... 734 20.11.9 notes on memory programming.......................................................................... 735 section 21 rom (sh7054f) ............................................................................................ 737 21.1 features.................................................................................................................. ............ 737 21.2 overview.................................................................................................................. .......... 738
xiii 21.2.1 block diagram...................................................................................................... 738 21.2.2 mode transitions.................................................................................................. 739 21.2.3 on-board programming modes ........................................................................... 740 21.2.4 flash memory emulation in ram....................................................................... 742 21.2.5 differences between boot mode and user program mode.................................. 743 21.2.6 block configuration ............................................................................................. 744 21.3 pin configuration ......................................................................................................... ..... 744 21.4 register configuration .................................................................................................... .. 745 21.5 register descriptions..................................................................................................... .... 746 21.5.1 flash memory control register 1 (flmcr1)..................................................... 746 21.5.2 flash memory control register 2 (flmcr2)..................................................... 748 21.5.3 erase block register 1 (ebr1)............................................................................ 749 21.5.4 erase block register 2 (ebr2)............................................................................ 749 21.5.5 ram emulation register (ramer) ................................................................... 751 21.6 on-board programming modes ........................................................................................ 753 21.6.1 boot mode............................................................................................................ 753 21.6.2 user program mode ............................................................................................. 758 21.7 programming/erasing flash memory................................................................................ 759 21.7.1 program mode...................................................................................................... 759 21.7.2 program-verify mode .......................................................................................... 760 21.7.3 erase mode........................................................................................................... 763 21.7.4 erase-verify mode ............................................................................................... 764 21.8 protection................................................................................................................ ........... 767 21.8.1 hardware protection............................................................................................. 767 21.8.2 software protection .............................................................................................. 768 21.8.3 error protection .................................................................................................... 768 21.9 flash memory emulation in ram.................................................................................... 770 21.10 note on flash memory programming/erasing.................................................................. 772 21.11 flash memory programmer mode .................................................................................... 772 21.11.1 socket adapter pin correspondence diagram ..................................................... 773 21.11.2 programmer mode operation............................................................................... 775 21.11.3 memory read mode............................................................................................. 776 21.11.4 auto-program mode ............................................................................................ 779 21.11.5 auto-erase mode.................................................................................................. 781 21.11.6 status read mode................................................................................................. 783 21.11.7 status polling........................................................................................................ 7 84 21.11.8 programmer mode transition time..................................................................... 784 21.11.9 notes on memory programming.......................................................................... 785 section 22 ram ................................................................................................................... 787 22.1 overview.................................................................................................................. .......... 787 22.2 operation ................................................................................................................. .......... 789
xiv section 23 power-down state .......................................................................................... 791 23.1 overview.................................................................................................................. .......... 791 23.1.1 power-down states .............................................................................................. 791 23.1.2 pin configuration ................................................................................................. 793 23.1.3 related registers.................................................................................................. 793 23.2 register descriptions..................................................................................................... .... 794 23.2.1 standby control register (sbycr) .................................................................... 794 23.2.2 system control register (syscr) ...................................................................... 795 23.2.3 module standby control register (mstcr)....................................................... 796 23.2.4 notes on register access ..................................................................................... 797 23.3 hardware standby mode ................................................................................................... 79 7 23.3.1 transition to hardware standby mode ................................................................ 797 23.3.2 canceling hardware standby mode .................................................................... 797 23.3.3 hardware standby mode timing ......................................................................... 798 23.4 software standby mode .................................................................................................... 7 98 23.4.1 transition to software standby mode.................................................................. 798 23.4.2 canceling software standby mode...................................................................... 800 23.4.3 software standby mode application example .................................................... 801 23.5 sleep mode................................................................................................................ ........ 802 23.5.1 transition to sleep mode ..................................................................................... 802 23.5.2 canceling sleep mode.......................................................................................... 802 section 24 electrical characteristics ............................................................................. 803 24.1 absolute maximum ratings.............................................................................................. 803 24.2 dc characteristics ........................................................................................................ ..... 804 24.3 ac characteristics ........................................................................................................ ..... 821 24.3.1 power-on/off timing .......................................................................................... 821 24.3.2 clock timing........................................................................................................ 822 24.3.3 control signal timing.......................................................................................... 824 24.3.4 bus timing ........................................................................................................... 827 24.3.5 advanced timer unit timing and advance pulse controller timing ................ 831 24.3.6 i/o port timing .................................................................................................... 833 24.3.7 watchdog timer timing ...................................................................................... 834 24.3.8 serial communication interface timing.............................................................. 835 24.3.9 hcan timing...................................................................................................... 837 24.3.10 a/d converter timing ......................................................................................... 838 24.3.11 aud timing ........................................................................................................ 840 24.3.12 ubc trigger timing ............................................................................................ 842 24.3.13 measuring conditions for ac characteristics ..................................................... 843 24.4 a/d converter characteristics .......................................................................................... 844
xv appendix a on-chip supporting module registers ................................................ 845 a.1 address .................................................................................................................... .......... 845 a.2 register states in reset and power-down states.............................................................. 881 appendix b pin states ....................................................................................................... 887 appendix c product code lineup ................................................................................. 890 appendix d package dimensions .................................................................................. 891
xvi
1 section 1 overview 1.1 features the sh7052f/sh7053f/sh7054f is a single-chip risc microcontroller that integrates a risc cpu core using an original hitachi architecture with peripheral functions required for system configuration. the cpu has a risc-type instruction set. basic instructions can be executed in one state (one system clock cycle), which greatly improves instruction execution speed. in addition, the 32-bit internal architecture enhances data processing power. with this cpu, it has become possible to assemble low-cost, high-performance/high-functionality systems even for applications such as real-time control, which could not previously be handled by microcontrollers because of their high-speed processing requirements. in addition, the sh7052f/sh7053f/sh7054f includes on-chip peripheral functions necessary for system configuration, such as rom , ram, a direct memory access controller (dmac), timers, a serial communication interface (sci), hitachi controller area network (hcan), a/d converter, interrupt controller (intc), and i/o ports. rom and sram can be directly connected by means of an external memory access support function, greatly reducing system cost. on-chip rom is available as flash memory in the f-ztat* (flexible zero turn around time) version. the flash memory can be programmed with a programmer that supports sh7052f/sh7053f/sh7054f programming, and can also be programmed and erased by software. this enables the chip to be programmed at the user site while mounted on a board. the features of the sh7052f/sh7053f/sh7054f are summarized in table 1.1. note : * f-ztat is a trademark of hitachi, ltd.
2 table 1.1 sh7052f/sh7053f/sh7054f features item features cpu ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
3 table 1.1 sh7052f/sh7053f/sh7054f features (cont) item features clock pulse generator (cpg/pll) ? ? ? ? irq0 irq3 ? ? ? ? ubctrg ? ? ? ? ? ? ? ? ? cs0 cs3 ? wait ? ?
4 table 1.1 sh7052f/sh7053f/sh7054f features (cont) item features direct memory access controller (dmac) (4 channels) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
5 table 1.1 sh7052f/sh7053f/sh7054f features (cont) item features serial communication interface (sci) (5 channels) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? irq res hstby adtrg ?
6 table 1.1 sh7052f/sh7053f/sh7054f features (cont) item features on-chip memory product memory sh7052f sh7053f sh7054f flash memory 256 kb 256 kb 384 kb ram 12 kb 16 kb 16 kb
7 1.2 block diagram rom (flash) 256kb/384kb * ram 12kb/16kb * dmac (4 channels) sci (5 channels) cmt (2 channels) aud hcan (1 channel) atu-ii a/d convertor wdt bsc interrupt controller clock pulse generator port port port/address signals port/address signals port port port/control signals pk15/to8p pk14/to8o pk13/to8n pk12/to8m pk11/to8l pk10/to8k pk9/to8j pk8/to8i pk7/to8h pk6/to8g pk5/to8f pk4/to8e pk3/to8d pk2/to8c pk1/to8b pk0/to8a pj15/ti9f pj14/ti9e pj13/ti9d pj12/ti9c pj11/ti9b pj10/ti9a pj9/tio5d pj8/tio5c pj7/tio2h pj6/tio2g pj5/tio2f pj4/tio2e pj3/tio2d pj2/tio2c pj1/tio2b pj0/tio2a ph15/d15 ph14/d14 ph13/d13 ph12/d12 ph11/d11 ph10/d10 ph9/d9 ph8/d8 ph7/d7 ph6/d6 ph5/d5 ph4/d4 ph3/d3 ph2/d2 ph1/d1 ph0/d0 pa0/ti0a pa1/ti0b pa2/ti0c pa3/ti0d pa4/tio3a pa5/tio3b pa6/tio3c pa7/tio3d pa8/tio4a pa9/tio4b pa10/tio4c pa11/tio4d pa12/tio5a pa13/tio5b pa14/txd0 pa15/rxd0 pb0/to6a pb1/to6b pb2/to6c pb3/to6d pb4/to7a/to8a pb5/to7b/to8b pb6/to7c/to8c pb7/to7d/to8d pb8/txd3/to8e pb9/rxd3/to8f pb10/txd4/htxd/to8g pb11/rxd4/hrxd/to8h pb12/tclka/ ubctrg pb13/sck0 pb14/sck1/tclkb/ti10 pb15/puls5/sck2 pc0/txd1 pc1/rxd1 pc2/txd2 pc3/rxd2 pc4/ irq0 pg0/puls7/hrxd pg1/ irq1 pg2/ irq2 pg3/ irq3 / adtrg0 pf15/ breq pf14/ back pf8/ wait pf9/ rd pf7/ wrh pf6/ wrl pf13/ cs3 pf12/ cs2 pf11/ cs1 pf10/ cs0 pf5/a21/ pod pf4/a20 pf3/a19 pf2/a18 pf1/a17 pf0/a16 pe15/a15 pe14/a14 pe13/a13 pe12/a12 pe11/a11 pe10/a10 pe9/a9 pe8/a8 pe7/a7 pe6/a6 pe5/a5 pe4/a4 pe3/a3 pe2/a2 pe1/a1 pe0/a0 pd0/tio1a pd1/tio1b pd2/tio1c pd3/tio1d pd4/tio1e pd5/tio1f pd6/tio1g pd7/tio1h pd8/puls0 pd9/puls1 pd10/puls2 pd11/puls3 pd12/puls4 pd13/puls6/htxd ck extal xtal pllv cc pllv ss pllcap vcc ( 6) pvcc1 ( 4) pvcc2 ( 6) vss ( 16) avref avcc avss an15 to 0 audrst audmd audata3 to 0 audck audsync res hstby fwe md2 md1 md0 nmi wdtovf : peripheral address bus (9 bits) : peripheral data bus (16 bits) : internal address bus (32 bits) : internal upper data bus (16 bits) : internal lower data bus (16 bits) cpu multipiler note: * sh7052f : rom 256kb ram 12kb sh7053f : rom 256kb ram 16kb sh7054f : rom 384kb ram 16kb figure 1.1 block diagram
8 1.3 pin description 1.3.1 pin arrangement 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 pf1/a17 pf2/a18 pf3/a19 pf4/a20 pf5/a21/ pod pf6/ wrl pf7/ wrh pf8/ wait pf9/ rd pvcc1 pf10/ cs0 vss pf11/ cs1 pf12/ cs2 pf13/ cs3 pf14/ back pf15/ breq md2 vcc ck vss md1 md0 extal vss xtal vcc fwe hstby res nmi pllvcc pllcap pllvss ph0/d0 ph1/d1 ph2/d2 ph3/d3 ph4/d4 ph5/d5 ph6/d6 pvcc1 ph7/d7 vss ph8/d8 ph9/d9 ph10/d10 ph11/d11 ph12/d12 ph13/d13 ph14/d14 ph15/d15 pb9/rxd3/to8f pb8/txd3/to8e pb7/to7d/to8d pb6/to7c/to8c pb5/to7b/to8b pb4/to7a/to8a pb3/to6d vss pb2/to6c pvcc2 pb1/to6b pb0/to6a pa15/rxd0 pa14/txd0 pa13/tio5b pa12/tio5a pa11/tio4d pa10/tio4c pa9/tio4b pa8/tio4a pa7/tio3d pa6/tio3c pa5/tio3b vss pa4/tio3a vcc pa3/ti0d pa2/ti0c vss pa1/ti0b pvcc2 pa0/ti0a wdtovf an15 an14 an13 an12 an11 an10 an9 an8 an7 an6 an5 an4 an3 an2 an1 an0 avss avref avcc pk13/to8n pvcc2 pk14/to8o vss pk15/to8p audrst audmd audata0 audata1 audata2 audata3 audck audsync pd0/tio1a pd1/tio1b pd2/tio1c pd3/tio1d pvcc2 pd4/tio1e vss pd5/tio1f pd6/tio1g pd7/tio1h pd8/puls0 pd9/puls1 pd10/puls2 vcc pd11/puls3 vss pd12/puls4 pd13/puls6/htxd pe0/a0 pe1/a1 pe2/a2 pe3/a3 pe4/a4 pe5/a5 pvcc1 pe6/a6 vss pe7/a7 pe8/a8 pe9/a9 pe10/a10 pe11/a11 pe12/a12 pe13/a13 pe14/a14 pvcc1 pe15/a15 vss pf0/a16 pk12/to8m pk11/to8l pk10/to8k pk9/to8j pk8/to8i pk7/to8h pk6/to8g pk5/to8f pk4/to8e pk3/to8d pk2/to8c pk1/to8b pk0/to8a vss pj15/ti9f pvcc2 pj14/ti9e pj13/ti9d pj12/ti9c pj11/ti9b pj10/ti9a pj9/tio5d pj8/tio5c vss pj7/tio2h vcc pj6/tio2g pj5/tio2f pj4/tio2e pj3/tio2d pj2/tio2c vss pj1/tio2b vcc pj0/tio2a pg3/ irq3 / adtrg0 pg2/ irq2 pg1/ irq1 pg0/puls7/hrxd vss pc4/ irq0 pvcc2 pc3/rxd2 pc2/txd2 pc1/rxd1 pc0/txd1 pb15/puls5/sck2 pb14/sck1/tclkb/ti10 pb13/sck0 pb12/tclka/ ubctrg pb11/rxd4/hrxd/to8h pb10/txd4/htxd/to8g 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 fp-208a (top view) index figure 1.2 pin arrangement
9 1.3.2 pin functions table 1.2 summarizes the pin functions. table 1.2 pin functions type symbol pin no. i/o name function power supply v cc 19, 27, 79, 123, 131, 183 input power supply power supply for chip-internal and system ports ( res , md2 to md0, fwe, hstby , nmi, ck, extal, xtal). connect all v cc pins to the system power supply. the chip will not operate if there are any open pins. pv cc 1 10, 42, 194, 205 input port power supply 1 power supply for bus ports (ports e, f, and h). connect all pv cc 1 pins to the system bus power supply. the chip will not operate if there are any open pins. pv cc 2 74, 95, 115, 141, 158, 174 input port power supply 2 power supply for peripheral module ports (ports a, b, c, d, g, j, k, the aud, and wdtovf ). connect all pv cc 2 pins to the system peripheral module power supply. the chip will not operate if there are any open pins. v ss 12, 21, 25, 44, 76, 81, 97, 117, 125, 133, 143, 160, 176, 185, 196, 207 input ground for connection to ground. connect all v ss pins to the system ground. the chip will not operate if there are any open pins. flash memory fwe 28 input flash write enable connected to ground in normal operation. apply v cc during on-board programming.
10 table 1.2 pin functions (cont) type symbol pin no. i/o name function clock pllv cc 32 input pll power supply on-chip pll oscillator power supply. for power supply connection, see section 4, clock pulse generator. pllv ss 34 input pll ground on-chip pll oscillator ground. for power supply connection, see section 4, clock pulse generator. pllcap 33 input pll capacitance on-chip pll oscillator external capacitance connection pin. for external capacitance connection, see section 4, clock pulse generator. extal 24 input external clock for connection to a crystal resonator. an external clock source can also be connected to the extal pin. xtal 26 input crystal for connection to a crystal resonator. ck 20 output system clock supplies the system clock to peripheral devices. system control res 30 input power-on reset executes a power-on reset when driven low. wdtovf 72 output watchdog timer overflow wdt overflow output signal. breq 17 input bus request driven low when an external device requests the bus. back 16 output bus request acknowledge indicates that the bus has been granted to an external device. the device that output the breq signal recognizes that the bus has been acquired when it receives the back signal.
11 table 1.2 pin functions (cont) type symbol pin no. i/o name function operating mode control md0 to md2 18, 22, 23 input mode setting these pins determine the operating mode. do not change the input values during operation. hstby 29 input hardware standby when driven low, this pin forces a transition to hardware standby mode. interrupts nmi 31 input nonmaskable interrupt nonmaskable interrupt request pin. acceptance on the rising edge or falling edge can be selected. irq0 to irq3 116, 119, 120, 121 input interrupt requests 0 to 3 maskable interrupt request pins. level input or edge input can be selected. address bus a0 to a21 1 to 5, 188 to 193, 195, 197 to 204, 206, 208 output address bus address output pins. data bus d0 to d15 35 to 41, 43, 45 to 52 input/ output data bus 16-bit bidirectional data bus pins. bus control cs0 to cs3 11, 13 to 15 output chip select 0 to 3 chip select signals for external memory or devices. rd 9 output read indicates reading from an external device. wrh 7 output upper write indicates writing of the upper 8 bits of external data. wrl 6 output lower write indicates writing of the lower 8 bits of external data. wait 8 input wait input for wait cycle insertion in bus cycles during external space access.
12 table 1.2 pin functions (cont) type symbol pin no. i/o name function advanced timer unit-ii tclka tclkb 107, 109 input atu-ii timer clock input atu-ii counter external clock input pins. (atu-ii) ti0a to ti0d 73, 75, 77, 78 input atu-ii input capture (channel 0) channel 0 input capture input pins. tio1a to tio1h 170 to 173, 175, 177 to 179 input/ output atu-ii input capture/output compare (channel 1) channel 1 input capture input/output compare output pins. tio2a to tio2h 122, 124, 126 to 130, 132 input/ output atu-ii input capture/output compare (channel 2) channel 2 input capture input/output compare output pins. tio3a to tio3d 80, 82 to 84 input/ output atu-ii input capture/output compare/ pwm output (channel 3) channel 3 input capture input/output compare/pwm output pins. tio4a to tio4d 85 to 88 input/ output atu-ii input capture/output compare/ pwm output (channel 4) channel 4 input capture input/output compare/pwm output pins. tio5a to tio5d 89, 90, 134, 135 input/ output atu-ii input capture/output compare/ pwm output (channel 5) channel 5 input capture input/output compare/pwm output pins. to6a to to6d 93, 94, 96, 98 output atu-ii pwm output (channel 6) channel 6 pwm output pins. to7a to to7d 99 to 102 output atu-ii pwm output (channel 7) channel 7 pwm output pins. to8a to to8p 99 to 106, 144 to 157, 159, 161 output atu-ii one-shot pulse (channel 8) channel 8 down-counter one- shot pulse output pins.
13 table 1.2 pin functions (cont) type symbol pin no. i/o name function advanced timer unit-ii (atu-ii) ti9a to ti9f 136 to 140, 142 input atu-ii event input (channel 9) channel 9 event counter input pins. ti10 109 input atu-ii multiplied clock generation (channel 10) channel 10 external clock input pin. advanced pulse controller (apc) puls0 to puls7 110, 118, 180 to 182, 184, 186, 187 output apc pulse outputs 0 to 7 apc pulse output pins. serial communication interface (sci) txd0 to txd4 91, 103, 105, 111, 113 output transmit data (channels 0 to 4) sci0 to sci4 transmit data output pins. rxd0 to rxd4 92, 104, 106, 112, 114 input receive data (channels 0 to 4) sci0 to sci4 receive data input pins. sck0 to sck2 108, 109, 110 input/ output serial clock (channels 0 to 2) sci0 to sci2 clock input/output pins. hitachi controller area htxd 105, 187 output transmit data can bus transmit data output pins. network (hcan) hrxd 106, 118 input receive data can bus receive data input pins. a/d converter av cc 53 input analog power supply a/d converter power supply. av ss 55 input analog ground a/d converter power supply. av ref 54 input analog reference power supply analog reference power supply input pins. an0 to an15 56 to 71 input analog input analog signal input pins. adtrg0 121 input a/d conversion trigger input external trigger input pins for starting a/d conversion.
14 table 1.2 pin functions (cont) type symbol pin no. i/o name function user break controller (ubc) ubctrg 107 output user break trigger output ubc condition match trigger output pin. advanced user debugger (aud) audata0 to audata3 164 to 167 input/ output aud data realtime trace mode: branch destination address output pins. ram monitor mode: monitor address input / data input/output pins. audrst 162 input aud reset reset signal input pin. audmd 163 input aud mode mode select signal input pin. realtime trace mode: low ram monitor mode: high audck 168 input/ output aud clock realtime trace mode: serial clock output pin. ram monitor mode: serial clock input pin. audsync 169 input/ output aud synchronization signal realtime trace mode: data start position identification signal output pin. ram monitor mode: data start position identification signal input pin. i/o ports pod 5 input port output disable input pin for port pin drive control when general port is set for output. pa0 to pa15 73, 75, 77, 78, 80, 82 to 92 input/ output port a general input/output port pins. input or output can be specified bit by bit.
15 table 1.2 pin functions (cont) type symbol pin no. i/o name function i/o ports pb0 to pb15 93, 94, 96, 98 to 110 input/ output port b general input/output port pins. input or output can be specified bit by bit. pc0 to pc4 111 to 114, 116 input/ output port c general input/output port pins. input or output can be specified bit by bit. pd0 to pd13 170 to 173, 175, 177 to 182, 184, 186, 187 input/ output port d general input/output port pins. input or output can be specified bit by bit. pe0 to pe15 188 to 193, 195, 197 to 204, 206 input/ output port e general input/output port pins. input or output can be specified bit by bit. pf0 to pf15 1 to 9, 11, 13 to 17, 208 input/ output port f general input/output port pins. input or output can be specified bit by bit. pg0 to pg3 118 to 121 input/ output port g general input/output port pins. input or output can be specified bit by bit. ph0 to ph15 35 to 41, 43, 45 to 52 input/ output port h general input/output port pins. input or output can be specified bit by bit. pj0 to pj15 122, 124, 126 to 130, 132, 134 to 140, 142 input/ output port j general input/output port pins. input or output can be specified bit by bit. pk0 to pk15 144 to 157, 159, 161 input/ output port k general input/output port pins. input or output can be specified bit by bit.
16 1.3.3 pin assignments table 1.3 pin assignments pin no. mcu mode programmer mode 1 pf1/a17 a17 2 pf2/a18 a18 3 pf3/a19 n.c 4 pf4/a20 n.c 5 pf5/a21/ pod n.c 6 pf6/ wrl n.c 7 pf7/ wrh n.c. 8 pf8/ wait n.c. 9 pf9/ rd n.c. 10 pvcc1 vcc 11 pf10/ cs0 n.c. 12 vss vss 13 pf11/ cs1 vcc 14 pf12/ cs2 vcc 15 pf13/ cs3 vss 16 pf14/ back n.c. 17 pf15/ breq vcc 18 md2 vss 19 vcc vcc 20 ck n.c. 21 vss vss 22 md1 vcc 23 md0 vcc 24 extal extal 25 vss vss 26 xtal xtal 27 vcc vcc 28 fwe fwe 29 hstby vcc 30 res res
17 table 1.3 pin assignments (cont) pin no. mcu mode programmer mode 31 nmi vss 32 pllvcc pllvcc 33 pllcap pllcap 34 pllvss pllvss 35 ph0/d0 d0 36 ph1/d1 d1 37 ph2/d2 d2 38 ph3/d3 d3 39 ph4/d4 d4 40 ph5/d5 d5 41 ph6/d6 d6 42 pvcc1 vcc 43 ph7/d7 d7 44 vss vss 45 ph8/d8 n.c. 46 ph9/d9 n.c. 47 ph10/d10 n.c. 48 ph11/d11 n.c. 49 ph12/d12 n.c. 50 ph13/d13 n.c. 51 ph14/d14 n.c. 52 ph15/d15 n.c. 53 avcc vcc 54 avref vcc 55 avss vss 56 an0 n.c. 57 an1 n.c. 58 an2 n.c. 59 an3 n.c. 60 an4 n.c. 61 an5 n.c.
18 table 1.3 pin assignments (cont) pin no. mcu mode programmer mode 62 an6 n.c. 63 an7 n.c. 64 an8 n.c. 65 an9 n.c. 66 an10 n.c. 67 an11 n.c. 68 an12 n.c. 69 an13 n.c. 70 an14 n.c. 71 an15 n.c. 72 wdtovf n.c. 73 pa0/ti0a n.c. 74 pvcc2 vcc 75 pa1/ti0b n.c. 76 vss vss 77 pa2/ti0c n.c. 78 pa3/ti0d n.c. 79 vcc vcc 80 pa4/tio3a n.c. 81 vss vss 82 pa5/tio3b n.c. 83 pa6/tio3c n.c. 84 pa7/tio3d n.c. 85 pa8/tio4a n.c. 86 pa9/tio4b n.c. 87 pa10/tio4c n.c. 88 pa11/tio4d n.c. 89 pa12/tio5a n.c. 90 pa13/tio5b n.c. 91 pa14/txd0 n.c. 92 pa15/rxd0 n.c.
19 table 1.3 pin assignments (cont) pin no. mcu mode programmer mode 93 pb0/to6a n.c. 94 pb1/to6b n.c. 95 pvcc2 vcc 96 pb2/to6c n.c. 97 vss vss 98 pb3/to6d n.c. 99 pb4/to7a/to8a n.c. 100 pb5/to7b/to8b n.c. 101 pb6/to7c/to8c n.c. 102 pb7/to7d/to8d n.c. 103 pb8/txd3/to8e n.c. 104 pb9/rxd3/to8f n.c. 105 pb10/txd4/htxd/to8g n.c. 106 pb11/rxd4/hrxd/to8h n.c. 107 pb12/tclka/ ubctrg n.c. 108 pb13/sck0 n.c. 109 pb14/sck1/tclkb/ti10 n.c. 110 pb15/puls5/sck2 n.c. 111 pc0/txd1 n.c. 112 pc1/rxd1 n.c. 113 pc2/txd2 n.c. 114 pc3/rxd2 n.c. 115 pvcc2 vcc 116 pc4/ irq0 n.c. 117 vss vss 118 pg0/puls7/hrxd n.c. 119 pg1/ irq1 ce 120 pg2/ irq2 we 121 pg3/ irq3 / adtrg0 oe 122 pj0/tio2a n.c. 123 vcc vcc
20 table 1.3 pin assignments (cont) pin no. mcu mode programmer mode 124 pj1/tio2b n.c. 125 vss vss 126 pj2/tio2c n.c. 127 pj3/tio2d n.c. 128 pj4/tio2e n.c. 129 pj5/tio2f n.c. 130 pj6/tio2g n.c. 131 vcc vcc 132 pj7/tio2h n.c. 133 vss vss 134 pj8/tio5c n.c. 135 pj9/tio5d n.c. 136 pj10/ti9a n.c. 137 pj11/ti9b n.c. 138 pj12/ti9c n.c. 139 pj13/ti9d n.c. 140 pj14/ti9e n.c. 141 pvcc2 vcc 142 pj15/ti9f n.c. 143 vss vss 144 pk0/to8a n.c. 145 pk1/to8b n.c. 146 pk2/to8c n.c. 147 pk3/to8d n.c. 148 pk4/to8e n.c. 149 pk5/to8f n.c. 150 pk6/to8g n.c. 151 pk7/to8h n.c. 152 pk8/to8i n.c. 153 pk9/to8j n.c. 154 pk10/to8k n.c.
21 table 1.3 pin assignments (cont) pin no. mcu mode programmer mode 155 pk11/to8l n.c. 156 pk12/to8m n.c. 157 pk13/to8n n.c. 158 pvcc2 vcc 159 pk14/to8o n.c. 160 vss vss 161 pk15/to8p n.c. 162 audrst n.c. 163 audmd n.c. 164 audata0 n.c. 165 audata1 n.c. 166 audata2 n.c. 167 audata3 n.c. 168 audck n.c. 169 audsync n.c. 170 pd0/tio1a n.c. 171 pd1/tio1b n.c. 172 pd2/tio1c n.c. 173 pd3/tio1d n.c. 174 pvcc2 vcc 175 pd4/tio1e n.c. 176 vss vss 177 pd5/tio1f n.c. 178 pd6/tio1g n.c. 179 pd7/tio1h n.c. 180 pd8/puls0 n.c. 181 pd9/puls1 n.c. 182 pd10/puls2 n.c. 183 vcc vcc 184 pd11/puls3 n.c. 185 vss vss
22 table 1.3 pin assignments (cont) pin no. mcu mode programmer mode 186 pd12/puls4 n.c. 187 pd13/puls6/htxd n.c. 188 pe0/a0 a0 189 pe1/a1 a1 190 pe2/a2 a2 191 pe3/a3 a3 192 pe4/a4 a4 193 pe5/a5 a5 194 pvcc1 vcc 195 pe6/a6 a6 196 vss vss 197 pe7/a7 a7 198 pe8/a8 a8 199 pe9/a9 a9 200 pe10/a10 a10 201 pe11/a11 a11 202 pe12/a12 a12 203 pe13/a13 a13 204 pe14/a14 a14 205 pvcc1 vcc 206 pe15/a15 a15 207 vss vss 208 pf0/a16 a16
23 section 2 cpu 2.1 register configuration the register set consists of sixteen 32-bit general registers, three 32-bit control registers and four 32-bit system registers. 2.1.1 general registers (rn) the sixteen 32-bit general registers (rn) are numbered r0 to r15. general registers are used for data processing and address calculation. r0 is also used as an index register. several instructions have r0 fixed as their only usable register. r15 is used as the hardware stack pointer (sp). saving and recovering the status register (sr) and program counter (pc) in exception processing is accomplished by referencing the stack using r15. figure 2.1 shows the general registers. r0* 1 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15, sp (hardware stack pointer)* 2 0 31 1. 2. r0 functions as an index register in the indirect indexed register addressing mode and indirect indexed gbr addressing mode. in some instructions, r0 functions as a fixed source register or destination register. r15 functions as a hardware stack pointer (sp) during exception processing. notes: figure 2.1 general registers
24 2.1.2 control registers the 32-bit control registers consist of the 32-bit status register (sr), global base register (gbr), and vector base register (vbr). the status register indicates processing states. the global base register functions as a base address for the indirect gbr addressing mode to transfer data to the registers of on-chip peripheral modules. the vector base register functions as the base address of the exception processing vector area (including interrupts). figure 2.2 shows a control register. 9876543210 mqi3 i2 i1 i0 st 0 0 31 31 gbr vbr sr 31 s bit: used by the mac instruction. reserved bits. this bit always read 0. the write value should always be 0. reserved bits. 0 is read. write only. bits i0 to i3: interrupt mask bits. m and q bits: used by the div0u, div0s, and div1 instructions. global base register (gbr): indicates the base address of the indirect gbr addressing mode. the indirect gbr addressing mode is used in data transfer for on-chip peripheral modules register areas and in logic operations. vector base register (vbr): stores the base address of the exception processing vector area. sr: status register t bit: the movt, cmp/cond, tas, tst, bt (bt/s), bf (bf/s), sett, and clrt instructions use the t bit to indicate true (1) or false (0). the addv, addc, subv, subc, div0u, div0s, div1, negc, shar, shal, shlr, shll, rotr, rotl, rotcr, and rotcl instructions also use the t bit to indicate carry/borrow or overflow/underflow. figure 2.2 control registers
25 2.1.3 system registers system registers consist of four 32-bit registers: high and low multiply and accumulate registers (mach and macl), the procedure register (pr), and the program counter (pc). the multiply and accumulate registers store the results of multiply and accumulate operations. the procedure register stores the return address from the subroutine procedure. the program counter stores program addresses to control the flow of the processing. figure 2.3 shows a system register. macl pr pc mach 31 0 0 0 31 31 multiply and accumulate (mac) registers high and low (mach, macl): stores the results of multiply and accumulate operations. procedure register (pr): stores a return address from a subroutine procedure. program counter (pc): indicates the fourth byte (second instruction) after the current instruction. figure 2.3 system registers 2.1.4 initial values of registers table 2.1 lists the values of the registers after reset. table 2.1 initial values of registers classification register initial value general registers r0 to r14 undefined r15 (sp) value of the stack pointer in the vector address table control registers sr bits i3 to i0 are 1111 (h'f), reserved bits are 0, and other bits are undefined gbr undefined vbr h'00000000 system registers mach, macl, pr undefined pc value of the program counter in the vector address table
26 2.2 data formats 2.2.1 data format in registers register operands are always longwords (32 bits). when the memory operand is only a byte (8 bits) or a word (16 bits), it is sign-extended into a longword when loaded into a register (figure 2.4). 31 0 longword figure 2.4 longword operand 2.2.2 data format in memory memory data formats are classified into bytes, words, and longwords. byte data can be located at any address, but word data must begin at address 2n and longword data at address 4n. an address error will occur if access is attempted beginning at an address other than these boundaries. in such cases, the data accessed cannot be guaranteed. the hardware stack area, referred to by the hardware stack pointer (sp, r15), uses only longword data starting from address 4n because this area holds the program counter and status register (figure 2.5). 31 0 15 23 7 byte byte byte byte word word address 2n address 4n longword address m address m + 2 address m + 1 address m + 3 figure 2.5 byte, word, and longword alignment 2.2.3 immediate data format byte (8-bit) immediate data resides in an instruction code. immediate data accessed by the mov, add, and cmp/eq instructions is sign-extended and handled in registers as longword data. immediate data accessed by the tst, and, or, and xor instructions is zero-extended and handled as longword data. consequently, and instructions with immediate data always clear the upper 24 bits of the destination register.
27 word or longword immediate data is not located in the instruction code, but instead is stored in a memory table. an immediate data transfer instruction (mov) accesses the memory table using the pc relative addressing mode with displacement. 2.3 instruction features 2.3.1 risc-type instruction set all instructions are risc type. this section details their functions. 16-bit fixed length : all instructions are 16 bits long, increasing program code efficiency. one instruction per cycle : the microprocessor can execute basic instructions in one cycle using the pipeline system. instructions are executed in 25 ns at 40 mhz. data length : longword is the standard data length for all operations. memory can be accessed in bytes, words, or longwords. byte or word data accessed from memory is sign-extended and handled as longword data. immediate data is sign-extended for arithmetic operations or zero- extended for logic operations. it also is handled as longword data (table 2.2). table 2.2 sign extension of word data sh7052f/sh7053f/sh7054f cpu description example of conventional cpu mov.w @(disp,pc),r1 add r1,r0 ......... .data.w h'1234 data is sign-extended to 32 bits, and r1 becomes h'00001234. it is next operated upon by an add instruction. add.w #h'1234,r0 note: @(disp, pc) accesses the immediate data. load-store architecture : basic operations are executed between registers. for operations that involve memory access, data is loaded to the registers and executed (load-store architecture). instructions such as and that manipulate bits, however, are executed directly in memory. delayed branch instructions : unconditional branch instructions are delayed branch instructions. with a delayed branch instruction, the branch is taken after execution of the instruction following the delayed branch instruction (table 2.3). this reduces pipeline disruption when branching. there are two types of conditional branch instructions: delayed branch instructions and ordinary branch instructions.
28 table 2.3 delayed branch instructions sh7052f/sh7053f/sh7054f cpu description example of conventional cpu bra trget add r1,r0 executes an add before branching to trget add.w r1,r0 bra trget multiplication/accumulation operation : 16-bit 16-bit 32-bit multiplication operations are executed in one to two cycles. 16-bit 16-bit + 64-bit 64-bit multiplication/accumulation operations are executed in two to three cycles. 32-bit 32-bit 64-bit and 32-bit 32-bit + 64bit 64-bit multiplication/accumulation operations are executed in two to four cycles. t bit : the t bit in the status register reflects the result of the comparison, and its value is the condition (true/false) that determines whether the program will branch. the number of instructions that change the t bit is kept to a minimum to improve the processing speed. table 2.4 t bit sh7052f/sh7053f/ sh7054f cpu description example of conventional cpu cmp/ge r1,r0 bt trget0 bf trget1 t bit is set when r0 cmp.w r1,r0 bge trget0 blt trget1 add #1,r0 cmp/eq #0,r0 bt trget t bit is not changed by add. t bit is set when r0 = 0. the program branches if r0 = 0. sub.w #1,r0 beq trget immediate data : byte (8-bit) immediate data resides in instruction code. word or longword immediate data is not input via instruction codes but is stored in a memory table. an immediate data transfer instruction (mov) accesses the memory table using the pc relative addressing mode with displacement (table 2.5).
29 table 2.5 immediate data accessing classification sh7052f/sh7053f/sh7054f cpu example of conventional cpu 8-bit immediate mov #h'12,r0 mov.b #h'12,r0 16-bit immediate mov.w @(disp,pc),r0 ................. .data.w h'1234 mov.w #h'1234,r0 32-bit immediate mov.l @(disp,pc),r0 ................. .data.l h'12345678 mov.l #h'12345678,r0 note: @(disp, pc) accesses the immediate data. absolute address : when data is accessed by absolute address, the value already in the absolute address is placed in the memory table. loading the immediate data when the instruction is executed transfers that value to the register and the data is accessed in the indirect register addressing mode (table 2.6). table 2.6 absolute address accessing classification sh7052f/sh7053f/sh7054f cpu example of conventional cpu absolute address mov.l @(disp,pc),r1 mov.b @r1,r0 .................. .data.l h'12345678 mov.b @h'12345678,r0 note: @(disp,pc) accesses the immediate data. 16-bit/32-bit displacement : when data is accessed by 16-bit or 32-bit displacement, the pre- existing displacement value is placed in the memory table. loading the immediate data when the instruction is executed transfers that value to the register and the data is accessed in the indirect indexed register addressing mode (table 2.7). table 2.7 displacement accessing classification sh7052f/sh7053f/sh7054f cpu example of conventional cpu 16-bit displacement mov.w @(disp,pc),r0 mov.w @(r0,r1),r2 .................. .data.w h'1234 mov.w @(h'1234,r1),r2 note: @(disp,pc) accesses the immediate data.
30 2.3.2 addressing modes table 2.8 describes addressing modes and effective address calculation. table 2.8 addressing modes and effective addresses addressing mode instruction format effective addresses calculation equation direct register addressing rn the effective address is register rn. (the operand is the contents of register rn.) indirect register addressing @rn the effective address is the content of register rn. rn rn rn post-increment indirect register addressing @rn+ the effective address is the content of register rn. a constant is added to the content of rn after the instruction is executed. 1 is added for a byte operation, 2 for a word operation, and 4 for a longword operation. rn rn 1/2/4 + rn + 1/2/4 rn (after the instruction executes) byte: rn + 1 @?n the effective address is the value obtained by subtracting a constant from rn. 1 is subtracted for a byte operation, 2 for a word operation, and 4 for a longword operation. rn 1/2/4 rn 1/2/4 rn 1/2/4 byte: rn 1
31 table 2.8 addressing modes and effective addresses (cont) addressing mode instruction format effective addresses calculation equation indirect register addressing with displacement @(disp:4, rn) the effective address is rn plus a 4-bit displacement (disp). the value of disp is zero- extended, and remains the same for a byte operation, is doubled for a word operation, and is quadrupled for a longword operation. rn rn + disp @(r0, rn) the effective address is the rn value plus r0. rn r0 rn + r0 + rn + r0 indirect gbr addressing with displacement @(disp:8, gbr) the effective address is the gbr value plus an 8-bit displacement (disp). the value of disp is zero- extended, and remains the same for a byte opera- tion, is doubled for a word operation, and is quadrupled for a longword operation. gbr 1/2/4 gbr + disp
32 table 2.8 addressing modes and effective addresses (cont) addressing mode instruction format effective addresses calculation equation indirect indexed gbr addressing @(r0, gbr) the effective address is the gbr value plus the r0. gbr r0 gbr + r0 + gbr + r0 pc relative addressing with displacement @(disp:8, pc) the effective address is the pc value plus an 8-bit displacement (disp). the value of disp is zero- extended, and is doubled for a word operation, and quadrupled for a longword operation. for a longword operation, the lowest two bits of the pc value are masked. pc h'fffffffc pc + disp
33 table 2.8 addressing modes and effective addresses (cont) addressing mode instruction format effective addresses calculation equation pc relative addressing disp:8 the effective address is the pc value sign-extended with an 8-bit displacement (disp), doubled, and added to the pc value. pc 2 + disp:12 the effective address is the pc value sign-extended with a 12-bit displacement (disp), doubled, and added to the pc value. pc 2 + rn the effective address is the register pc value plus rn. pc rn pc + rn + pc + rn immediate addressing #imm:8 the 8-bit immediate data (imm) for the tst, and, or, and xor instructions are zero-extended. #imm:8 the 8-bit immediate data (imm) for the mov, add, and cmp/eq instructions are sign-extended. #imm:8 the 8-bit immediate data (imm) for the trapa instruction is zero-extended and is quadrupled.
34 2.3.3 instruction format table 2.9 lists the instruction formats for the source operand and the destination operand. the meaning of the operand depends on the instruction code. the symbols are used as follows: ? xxxx: instruction code ? mmmm: source register ? nnnn: destination register ? iiii: immediate data ? dddd: displacement table 2.9 instruction formats instruction formats source operand destination operand example 0 format xxxx xxxx xxxx xxxx 15 0 ?? nop n format nnnn: direct register movt rn xxxx xxxx xxxx nnnn 15 0 control register or system register nnnn: direct register sts mach,rn control register or system register nnnn: indirect pre- decrement register stc.l sr,@-rn m format mmmm: direct register control register or system register ldc rm,sr xxxx mmmm xxxx xxxx 15 0 mmmm: indirect post-increment register control register or system register ldc.l @rm+,sr mmmm: direct register jmp @rm mmmm: pc relative using rm braf rm
35 table 2.9 instruction formats (cont) instruction formats source operand destination operand example nm format mmmm: direct register nnnn: direct register add rm,rn nnnn xxxx xxxx 15 0 mmmm mmmm: direct register nnnn: indirect register mov.l rm,@rn mmmm: indirect post-increment register (multiply/ accumulate) nnnn*: indirect post-increment register (multiply/ accumulate) mach, macl mac.w @rm+,@rn+ mmmm: indirect post-increment register nnnn: direct register mov.l @rm+,rn mmmm: direct register nnnn: indirect pre- decrement register mov.l rm,@-rn mmmm: direct register nnnn: indirect indexed register mov.l rm,@(r0,rn) md format xxxx dddd 15 0 mmmm xxxx mmmmdddd: indirect register with displacement r0 (direct register) mov.b @(disp,rm),r0 nd4 format xxxx xxxx dddd 15 0 nnnn r0 (direct register) nnnndddd: indirect register with displacement mov.b r0,@(disp,rn) nmd format nnnn xxxx dddd 15 0 mmmm mmmm: direct register nnnndddd: indirect register with displacement mov.l rm,@(disp,rn) mmmmdddd: indirect register with displacement nnnn: direct register mov.l @(disp,rm),rn note: * in multiply/accumulate instructions, nnnn is the source register.
36 table 2.9 instruction formats (cont) instruction formats source operand destination operand example d format dddd xxxx 15 0 xxxx dddd dddddddd: indirect gbr with displacement r0 (direct register) mov.l @(disp,gbr),r0 r0(direct register) dddddddd: indirect gbr with displacement mov.l r0,@(disp,gbr) dddddddd: pc relative with displacement r0 (direct register) mova @(disp,pc),r0 dddddddd: pc relative bf label d12 format dddd xxxx 15 0 dddd dddd dddddddddddd: pc relative bra label (label = disp + pc) nd8 format dddd nnnn xxxx 15 0 dddd dddddddd: pc relative with displacement nnnn: direct register mov.l @(disp,pc),rn i format iiiiiiii: immediate indirect indexed gbr and.b #imm,@(r0,gbr) xxxx xxxx i i i i 15 0 i i i i iiiiiiii: immediate r0 (direct register) and #imm,r0 iiiiiiii: immediate trapa #imm ni format nnnn i i i i xxxx 15 0 i i i i iiiiiiii: immediate nnnn: direct register add #imm,rn
37 2.4 instruction set by classification table 2.10 classification of instructions classification types operation code function no. of instructions data transfer 5 mov data transfer, immediate data transfer, peripheral module data transfer, structure data transfer 39 mova effective address transfer movt t bit transfer swap swap of upper and lower bytes xtrct extraction of the middle of registers connected arithmetic 21 add binary addition 33 operations addc binary addition with carry addv binary addition with overflow check cmp/cond comparison div1 division div0s initialization of signed division div0u initialization of unsigned division dmuls signed double-length multiplication dmulu unsigned double-length multiplication dt decrement and test exts sign extension extu zero extension mac multiply/accumulate, double-length multiply/accumulate operation mul double-length multiply operation muls signed multiplication mulu unsigned multiplication neg negation negc negation with borrow sub binary subtraction subc binary subtraction with borrow subv binary subtraction with underflow
38 table 2.10 classification of instructions (cont) classification types operation code function no. of instructions logic 6 and logical and 14 operations not bit inversion or logical or tas memory test and bit set tst logical and and t bit set xor exclusive or shift 10 rotl one-bit left rotation 14 rotr one-bit right rotation rotcl one-bit left rotation with t bit rotcr one-bit right rotation with t bit shal one-bit arithmetic left shift shar one-bit arithmetic right shift shll one-bit logical left shift shlln n-bit logical left shift shlr one-bit logical right shift shlrn n-bit logical right shift branch 9 bf conditional branch, conditional branch with delay (branch when t = 0) 11 bt conditional branch, conditional branch with delay (branch when t = 1) bra unconditional branch braf unconditional branch bsr branch to subroutine procedure bsrf branch to subroutine procedure jmp unconditional branch jsr branch to subroutine procedure rts return from subroutine procedure
39 table 2.10 classification of instructions (cont) classification types operation code function no. of instructions system 11 clrt t bit clear 31 control clrmac mac register clear ldc load to control register lds load to system register nop no operation rte return from exception processing sett t bit set sleep shift into power-down mode stc storing control register data sts storing system register data trapa trap exception handling total: 62 142 table 2.11 shows the format used in tables 2.12 to 2.17, which list instruction codes, operation, and execution states in order by classification.
40 table 2.11 instruction code format item format explanation instruction op.sz src,dest op: operation code sz: size (b: byte, w: word, or l: longword) src: source dest: destination rm: source register rn: destination register imm: immediate data disp: displacement* 1 instruction code msb ? sh-1/sh-2/sh-dsp programming manual . 2. instruction execution cycles: the execution cycles shown in the table are minimums. the actual number of cycles may be increased when (1) contention occurs between instruction fetches and data access, or (2) when the destination register of the load instruction (memory
41 table 2.12 data transfer instructions instruction instruction code operation execu- tion cycles t bit mov #imm,rn 1110nnnniiiiiiii #imm mov.w @(disp,pc),rn 1001nnnndddddddd (disp mov.l @(disp,pc),rn 1101nnnndddddddd (disp mov rm,rn 0110nnnnmmmm0011 rm mov.b rm,@rn 0010nnnnmmmm0000 rm mov.w rm,@rn 0010nnnnmmmm0001 rm mov.l rm,@rn 0010nnnnmmmm0010 rm mov.b @rm,rn 0110nnnnmmmm0000 (rm) mov.w @rm,rn 0110nnnnmmmm0001 (rm) mov.l @rm,rn 0110nnnnmmmm0010 (rm) mov.b rm,@?n 0010nnnnmmmm0100 rn 1 mov.w rm,@?n 0010nnnnmmmm0101 rn 2 mov.l rm,@?n 0010nnnnmmmm0110 rn 4 mov.b @rm+,rn 0110nnnnmmmm0100 (rm) mov.w @rm+,rn 0110nnnnmmmm0101 (rm) mov.l @rm+,rn 0110nnnnmmmm0110 (rm) mov.b r0,@(disp,rn) 10000000nnnndddd r0 mov.w r0,@(disp,rn) 10000001nnnndddd r0 mov.l rm,@(disp,rn) 0001nnnnmmmmdddd rm mov.b @(disp,rm),r0 10000100mmmmdddd (disp + rm) mov.w @(disp,rm),r0 10000101mmmmdddd (disp mov.l @(disp,rm),rn 0101nnnnmmmmdddd (disp mov.b rm,@(r0,rn) 0000nnnnmmmm0100 rm
42 table 2.12 data transfer instructions (cont) instruction instruction code operation execu- tion cycles t bit mov.w rm,@(r0,rn) 0000nnnnmmmm0101 rm mov.l rm,@(r0,rn) 0000nnnnmmmm0110 rm mov.b @(r0,rm),rn 0000nnnnmmmm1100 (r0 + rm) mov.w @(r0,rm),rn 0000nnnnmmmm1101 (r0 + rm) mov.l @(r0,rm),rn 0000nnnnmmmm1110 (r0 + rm) mov.b r0,@(disp,gbr) 11000000dddddddd r0 mov.w r0,@(disp,gbr) 11000001dddddddd r0 mov.l r0,@(disp,gbr) 11000010dddddddd r0 mov.b @(disp,gbr),r0 11000100dddddddd (disp + gbr) mov.w @(disp,gbr),r0 11000101dddddddd (disp mov.l @(disp,gbr),r0 11000110dddddddd (disp mova @(disp,pc),r0 11000111dddddddd disp movt rn 0000nnnn00101001 t swap.b rm,rn 0110nnnnmmmm1000 rm swap.w rm,rn 0110nnnnmmmm1001 rm xtrct rm,rn 0010nnnnmmmm1101 rm: middle 32 bits of rn
43 table 2.13 arithmetic operation instructions instruction instruction code operation execu- tion cycles t bit add rm,rn 0011nnnnmmmm1100 rn + rm add #imm,rn 0111nnnniiiiiiii rn + imm addc rm,rn 0011nnnnmmmm1110 rn + rm + t addv rm,rn 0011nnnnmmmm1111 rn + rm cmp/eq #imm,r0 10001000iiiiiiii if r0 = imm, 1 cmp/eq rm,rn 0011nnnnmmmm0000 if rn = rm, 1 cmp/hs rm,rn 0011nnnnmmmm0010 if rn cmp/ge rm,rn 0011nnnnmmmm0011 if rn cmp/hi rm,rn 0011nnnnmmmm0110 if rn > rm with unsigned data, 1 cmp/gt rm,rn 0011nnnnmmmm0111 if rn > rm with signed data, 1 cmp/pl rn 0100nnnn00010101 if rn > 0, 1 cmp/pz rn 0100nnnn00010001 if rn cmp/str rm,rn 0010nnnnmmmm1100 if rn and rm have an equivalent byte, 1 div1 rm,rn 0011nnnnmmmm0100 single-step division (rn/rm) 1 calculation result div0s rm,rn 0010nnnnmmmm0111 msb of rn div0u 0000000000011001 0
44 table 2.13 arithmetic operation instructions (cont) instruction instruction code operation execu- tion cycles t bit dmuls.l rm,rn 0011nnnnmmmm1101 signed operation of rn dmulu.l rm,rn 0011nnnnmmmm0101 unsigned operation of rn dt rn 0100nnnn00010000 rn 1 exts.b rm,rn 0110nnnnmmmm1110 a byte in rm is sign- extended exts.w rm,rn 0110nnnnmmmm1111 a word in rm is sign- extended extu.b rm,rn 0110nnnnmmmm1100 a byte in rm is zero- extended extu.w rm,rn 0110nnnnmmmm1101 a word in rm is zero- extended mac.l @rm+,@rn+ 0000nnnnmmmm1111 signed operation of (rn) + mac.w @rm+,@rn+ 0100nnnnmmmm1111 signed operation of (rn) mul.l rm,rn 0000nnnnmmmm0111 rn muls.w rm,rn 0010nnnnmmmm1111 signed operation of rn mulu.w rm,rn 0010nnnnmmmm1110 unsigned operation of rn neg rm,rn 0110nnnnmmmm1011 0 rm negc rm,rn 0110nnnnmmmm1010 0 rm t
45 table 2.13 arithmetic operation instructions (cont) instruction instruction code operation execu- tion cycles t bit sub rm,rn 0011nnnnmmmm1000 rn rm subc rm,rn 0011nnnnmmmm1010 rn rm t subv rm,rn 0011nnnnmmmm1011 rn rm
46 table 2.14 logic operation instructions instruction instruction code operation execu- tion cycles t bit and rm,rn 0010nnnnmmmm1001 rn & rm and #imm,r0 11001001iiiiiiii r0 & imm and.b #imm,@(r0,gbr) 11001101iiiiiiii (r0 + gbr) & imm not rm,rn 0110nnnnmmmm0111 ~rm or rm,rn 0010nnnnmmmm1011 rn | rm or #imm,r0 11001011iiiiiiii r0 | imm or.b #imm,@(r0,gbr) 11001111iiiiiiii (r0 + gbr) | imm tas.b @rn 0100nnnn00011011 if (rn) is 0, 1 tst rm,rn 0010nnnnmmmm1000 rn & rm; if the result is 0, 1 tst #imm,r0 11001000iiiiiiii r0 & imm; if the result is 0, 1 tst.b #imm,@(r0,gbr) 11001100iiiiiiii (r0 + gbr) & imm; if the result is 0, 1 xor rm,rn 0010nnnnmmmm1010 rn ^ rm xor #imm,r0 11001010iiiiiiii r0 ^ imm xor.b #imm,@(r0,gbr) 11001110iiiiiiii (r0 + gbr) ^ imm
47 table 2.15 shift instructions instruction instruction code operation execu- tion cycles t bit rotl rn 0100nnnn00000100 t rotr rn 0100nnnn00000101 lsb rotcl rn 0100nnnn00100100 t rotcr rn 0100nnnn00100101 t shal rn 0100nnnn00100000 t shar rn 0100nnnn00100001 msb shll rn 0100nnnn00000000 t shlr rn 0100nnnn00000001 0 shll2 rn 0100nnnn00001000 rn<<2 shlr2 rn 0100nnnn00001001 rn>>2 shll8 rn 0100nnnn00011000 rn<<8 shlr8 rn 0100nnnn00011001 rn>>8 shll16 rn 0100nnnn00101000 rn<<16 shlr16 rn 0100nnnn00101001 rn>>16
48 table 2.16 branch instructions instruction instruction code operation exec. cycles t bit bf label 10001011dddddddd if t = 0, disp bf/s label 10001111dddddddd delayed branch, if t = 0, disp bt label 10001001dddddddd if t = 1, disp bt/s label 10001101dddddddd delayed branch, if t = 1, disp bra label 1010dddddddddddd delayed branch, disp braf rm 0000mmmm00100011 delayed branch, rm + pc bsr label 1011dddddddddddd delayed branch, pc bsrf rm 0000mmmm00000011 delayed branch, pc jmp @rm 0100mmmm00101011 delayed branch, rm jsr @rm 0100mmmm00001011 delayed branch, pc rts 0000000000001011 delayed branch, pr
49 table 2.17 system control instructions instruction instruction code operation exec. cycles t bit clrt 0000000000001000 0 clrmac 0000000000101000 0 ldc rm,sr 0100mmmm00001110 rm ldc rm,gbr 0100mmmm00011110 rm ldc rm,vbr 0100mmmm00101110 rm ldc.l @rm+,sr 0100mmmm00000111 (rm) ldc.l @rm+,gbr 0100mmmm00010111 (rm) ldc.l @rm+,vbr 0100mmmm00100111 (rm) lds rm,mach 0100mmmm00001010 rm lds rm,macl 0100mmmm00011010 rm lds rm,pr 0100mmmm00101010 rm lds.l @rm+,mach 0100mmmm00000110 (rm) lds.l @rm+,macl 0100mmmm00010110 (rm) lds.l @rm+,pr 0100mmmm00100110 (rm) nop 0000000000001001 no operation 1 rte 0000000000101011 delayed branch, stack area sett 0000000000011000 1 sleep 0000000000011011 sleep 3* stc sr,rn 0000nnnn00000010 sr stc gbr,rn 0000nnnn00010010 gbr stc vbr,rn 0000nnnn00100010 vbr stc.l sr,@?n 0100nnnn00000011 rn 4 stc.l gbr,@?n 0100nnnn00010011 rn 4 stc.l vbr,@?n 0100nnnn00100011 rn 4 sts mach,rn 0000nnnn00001010 mach sts macl,rn 0000nnnn00011010 macl sts pr,rn 0000nnnn00101010 pr
50 table 2.17 system control instructions (cont) instruction instruction code operation exec. cycles t bit sts.l mach,@?n 0100nnnn00000010 rn 4 sts.l macl,@?n 0100nnnn00010010 rn 4 sts.l pr,@?n 0100nnnn00100010 rn 4 trapa #imm 11000011iiiiiiii pc/sr 4 + 2.5 processing states 2.5.1 state transitions the cpu has five processing states: reset, exception processing, bus release, program execution and power-down. figure 2.6 shows the transitions between the states.
51 power-on reset state sleep mode software standby mode hardware standby mode program execution state bus release state exception processing state res res hstby res hstby res hstby figure 2.6 transitions between processing states
52 reset state: the cpu resets in the reset state. when the res pin level goes low, a power-on reset results. when the res pin is high and mres is low, a manual reset will occur. exception processing state : the exception processing state is a transient state that occurs when exception processing sources such as resets or interrupts alter the cpu? processing state flow. for a reset, the initial values of the program counter (pc) (execution start address) and stack pointer (sp) are fetched from the exception processing vector table and stored; the cpu then branches to the execution start address and execution of the program begins. for an interrupt, the stack pointer (sp) is accessed and the program counter (pc) and status register (sr) are saved to the stack area. the exception service routine start address is fetched from the exception processing vector table; the cpu then branches to that address and the program starts executing, thereby entering the program execution state. program execution state : in the program execution state, the cpu sequentially executes the program. power-down state : in the power-down state, the cpu operation halts and power consumption declines. the sleep instruction places the cpu in the power-down state. this state has two modes: sleep mode and standby mode. in addition, driving the hstby pin low while the res pin is low causes a transition to hardware standby mode. bus release state : in the bus release state, the cpu releases access rights to the bus to the device that has requested them.
53 section 3 operating modes 3.1 operating mode selection the sh7052f/sh7053f/sh7054f has five operating modes that are selected by pins md2 to md0 and fwe. the mode setting pins should not be changed during operation of the sh7052f/sh7053f/sh7054f, and only the setting combinations shown in table 3.1 should be used. the pv cc 1 power supply voltage must be within the range shown in table 3.1. table 3.1 operating mode selection operating pin settings on-chip area 0 bus mode no. fwe md2 md1 md0 mode name rom width pv cc 1 voltage mode 0 0100 mcu expanded disabled 8 bits 3.3 v 0.3 v mode 1 0101 mode 16 bits mode 2 0110 enabled set by bcr1 mode 3 0111 mcu single-chip mode enabled ? 5.0 v 0.5 v mode 4 1100 boot mode enabled set by bcr1 3.3 v 0.3 v mode 5 1101 ? 5.0 v 0.5 v mode 6 1110 user program mode enabled set by bcr1 3.3 v 0.3 v mode 7 1111 ? 5.0 v 0.5 v ? 0/1 0 1 1 programmer mode ? ? 3.3 v 0.3 v there are two mcu operating modes: mcu single-chip mode and mcu expanded mode. modes in which the flash memory can be programmed are boot mode and user program mode (the two on-board programming modes) and programmer mode in which programming is performed with an eprom programmer (a type which supports programming of this device). for details, see section 20, rom (sh7052f/sh7053f) and section 21, rom (sh7054f). caution: in the sh7052f/sh7053f/sh7054f expanded modes (modes 0, 1, and 2), the guaranteed operating range of bus port power supply (port power supply 1: pv cc 1) in the mcu expanded modes is 3.3 v 0.3 v. since operation is not guaranteed in the mcu expanded modes on a voltage outside this range, a voltage within this range must be used.
54
55 section 4 clock pulse generator (cpg) 4.1 overview the clock pulse generator (cpg) supplies clock pulses inside the sh7052f/sh7053f/sh7054f chip and to external devices. the sh7052f/sh7053f/sh7054f cpg consists of an oscillator circuit and a pll multiplier circuit. there are two methods of generating a clock with the cpg: by connecting a crystal resonator, or by inputting an external clock. the oscillator circuit oscillates at the same frequency as the input clock. a chip operating frequency of 4 times the oscillator frequency is generated by the pll multiplier circuit. the cpg is halted in software standby mode and hardware standby mode. 4.1.1 block diagram a block diagram of the clock pulse generator is shown in figure 4.1. oscillator circuit cpg extal xtal pllvcc pllvss pllcap ck (system clock) internal clock f figure 4.1 block diagram of clock pulse generator
56 4.1.2 pin configuration the pins relating to the clock pulse generator are shown in table 4.1. table 4.1 cpg pins pin name abbreviation i/o description external clock extal input crystal resonator or external clock input crystal xtal input crystal resonator connection system clock ck output system clock output pll power supply pllv cc input pll multiplier circuit power supply pll ground pllv ss input pll multiplier circuit ground pll capacitance pllcap input pll multiplier circuit oscillation external capacitance pin 4.2 frequency ranges the input frequency and operating frequency ranges are shown in table 4.2. table 4.2 input frequency and operating frequency input frequency range (mhz) pll multiplication factor operating frequency range (mhz) 5 to 10 for the chip operating frequency, a frequency of 4 times the input frequency (extal pin) is generated as the internal clock ( ) by the on-chip pll circuit. the system clock (ck pin) output frequency is the same as that of the internal clock ( ). some on-chip peripheral modules operate on a peripheral clock (p ) obtained by dividing the internal clock ( ) by 2. figure 4.2 shows the relationship between the various clocks. as regards the system clock, since the input clock is multiplied by the pll multiplier circuit, the phases of both clocks are not determined uniformly.
57 input clock (extal pin) system clock (ck pin) internal clock ( figure 4.2 input clock and system clock 4.3 clock source clock pulses can be supplied from a connected crystal resonator or an external clock. 4.3.1 connecting a crystal oscillator circuit configuration: figure 4.3 shows an example of connecting a crystal resonator. use the damping resistance (rd) shown in table 4.3. an at-cut parallel-resonance type crystal resonator should be used. load capacitors (cl1, cl2) must be connected as shown in the figure. the clock pulses generated by the crystal resonator and internal oscillator are sent to the pll multiplier circuit, where a multiplied frequency is selected and supplied inside the sh7052f/sh7053f/sh7054f chip and to external devices. the crystal oscillator manufacturer should be consulted concerning the compatibility between the crystal oscillator and the chip. xtal extal cl2 cl1 rd cl1 = cl2 = 18 to 22 pf (recommended value) figure 4.3 connection of crystal oscillator (example)
58 table 4.3 damping resistance values (recommended values) frequency (mhz) parameter 5 10 rd ( ? crystal oscillator: figure 4.4 shows an equivalent circuit of the crystal oscillator. use a crystal oscillator with the characteristics listed in table 4.4. c0 extal cl lrs xtal figure 4.4 crystal oscillator equivalent circuit table 4.4 crystal oscillator parameters (recommended values) frequency (mhz) parameter 5 10 rs max ( ? the crystal oscillator manufacturer should be consulted concerning the compatibility between the crystal oscillator and the chip. 4.3.2 external clock input method an example of external clock input connection is shown in figure 4.5. when the xtal pin is placed in the open state, the parasitic capacitance should be 10 pf or less. even when an external clock is input, provide for a wait of at least the oscillation settling time when powering on or exiting standby mode in order to secure the pll settling time.
59 xtal extal open external clock input figure 4.5 external clock input method (example) 4.4 usage notes notes on board design: when connecting a crystal oscillator, observe the following precautions: ? to prevent induction from interfering with correct oscillation, do not route any signal lines near the oscillator circuitry (figure 4.6). ? when designing the board, place the crystal oscillator and its load capacitors as close as possible to the xtal and extal pins. figure 4.6 shows the precautions regarding oscillator circuit system board design. crossing of signal lines prohibited cl1 xtal extal cl2 figure 4.6 precautions for oscillator circuit system board design pll oscillation power supply: place oscillation capacitor c1 and resistor r1 close to the pll cap pin, and ensure that no other signal lines cross this line. supply the c1 ground from pllv ss . separate pllv cc and pllv ss from the other v cc and v ss lines at the board power supply source, and be sure to insert bypass capacitors c pb and c b close to the pins.
60 pllcap pllv cc pllv ss v cc v ss recommended values c pb , c b : 0.1 ? ? figure 4.7 points for caution in pll power supply connection extal vss xtal vcc pllvcc pllcap pllvss figure 4.8 actual example of board design
61 section 5 exception processing 5.1 overview 5.1.1 types of exception processing and priority exception processing is started by four sources: resets, address errors, interrupts and instructions and have the priority shown in table 5.1. when several exception processing sources occur at once, they are processed according to the priority shown. table 5.1 types of exception processing and priority order exception source priority reset power-on reset high manual reset address cpu address error error dmac address error interrupt nmi user break irq on-chip peripheral modules: ? ? ? ? ? ? ? ? ?
62 5.1.2 exception processing operations the exception processing sources are detected and begin processing according to the timing shown in table 5.2. table 5.2 timing of exception source detection and start of exception processing exception source timing of source detection and start of processing reset power-on reset starts when the res when exception processing starts, the cpu operates as follows: 1. exception processing triggered by reset: the initial values of the program counter (pc) and stack pointer (sp) are fetched from the exception processing vector table (pc and sp are respectively the h'00000000 and h'00000004 addresses for power-on resets and the h'00000008 and h'0000000c addresses for manual resets). see section 5.1.3, exception processing vector table, for more information. h'00000000 is then written to the vector base register (vbr) and h'f (1111) is written to the interrupt mask bits (i3 to i0) of the status register (sr). the program begins running from the pc address fetched from the exception processing vector table. 2. exception processing triggered by address errors, interrupts and instructions: sr and pc are saved to the stack indicated by r15. for interrupt exception processing, the interrupt priority level is written to the sr? interrupt mask bits (i3 to i0). for address error and instruction exception processing, the i3 to i0 bits are not affected. the start address is then fetched from the exception processing vector table and the program begins running from that address.
63 5.1.3 exception processing vector table before exception processing begins running, the exception processing vector table must be set in memory. the exception processing vector table stores the start addresses of exception service routines. (the reset exception processing table holds the initial values of pc and sp.) all exception sources are given different vector numbers and vector table address offsets, from which the vector table addresses are calculated. during exception processing, the start addresses of the exception service routines are fetched from the exception processing vector table, which is indicated by this vector table address. table 5.3 shows the vector numbers and vector table address offsets. table 5.4 shows how vector table addresses are calculated. table 5.3 exception processing vector table exception sources vector numbers vector table address offset power-on reset pc 0 h'00000000 to h'00000003 sp 1 h'00000004 to h'00000007 manual reset pc 2 h'00000008 to h'0000000b sp 3 h'0000000c to h'0000000f general illegal instruction 4 h'00000010 to h'00000013 (reserved by system) 5 h'00000014 to h'00000017 slot illegal instruction 6 h'00000018 to h'0000001b (reserved by system) 7 h'0000001c to h'0000001f 8 h'00000020 to h'00000023 cpu address error 9 h'00000024 to h'00000027 dmac address error 10 h'00000028 to h'0000002b interrupts nmi 11 h'0000002c to h'0000002f user break 12 h'00000030 to h'00000033 (reserved by system) 13 : 31 h'00000034 to h'00000037 : h'0000007c to h'0000007f
64 table 5.3 exception processing vector table (cont) exception sources vector numbers vector table address offset trap instruction (user vector) 32 : 63 h'00000080 to h'00000083 : h'000000fc to h'000000ff interrupts irq0 64 h'00000100 to h'00000103 irq1 65 h'00000104 to h'00000107 irq2 66 h'00000108 to h'0000010b irq3 67 h'0000010c to h'0000010f reserved by system 68 to 71 h'00000110 to h'0000011f on-chip peripheral module* 72 : 255 h'00000120 to h'00000124 : h'000003fc to h'000003ff note: * the vector numbers and vector table address offsets for each on-chip peripheral module interrupt are given in table 6.3, interrupt exception processing vectors and priorities, in section 6, interrupt controller. table 5.4 calculating exception processing vector table addresses exception source vector table address calculation resets vector table address = (vector table address offset) = (vector number)
65 5.2 resets 5.2.1 types of reset a reset is the highest-priority exception processing source. there are two kinds of reset, power-on and manual. as shown in table 5.5, the cpu state is initialized in both a power-on reset and a manual reset. on-chip peripheral module registers are also initialized by a power-on reset, but not by a manual reset. table 5.5 exception source detection and exception processing start timing conditions for transition to reset state internal states type res wdt overflow cpu/mult/ fpu/intc on-chip peripheral modules pfc, io port power-on reset low ? initialized initialized initialized high power-on reset initialized initialized not initialized manual reset high manual reset initialized not initialized not initialized 5.2.2 power-on reset power-on reset by means of res pin: when the res pin is driven low, the chip enters the power-on reset state. to reliably reset the chip, the res pin should be kept at the low level for at least the duration of the oscillation settling time at power-on or when in standby mode (when the clock is halted), or at least 20 t cyc when the clock is running. in the power-on reset state, the cpu? internal state and all the on-chip peripheral module registers are initialized. see appendix b, pin states, for the state of individual pins in the power-on reset state. in the power-on reset state, power-on reset exception processing starts when the res pin is first driven low for a set period of time and then returned to high. the cpu operates as follows: 1. the initial value (execution start address) of the program counter (pc) is fetched from the exception processing vector table. 2. the initial value of the stack pointer (sp) is fetched from the exception processing vector table. 3. the vector base register (vbr) is cleared to h'00000000 and the interrupt mask bits (i3 to i0) of the status register (sr) are set to h'f (1111). 4. the values fetched from the exception processing vector table are set in the pc and sp, and the program begins executing. be certain to always perform power-on reset processing when turning the system power on.
66 power-on reset initiated by wdt: when a setting is made for a power-on reset to be generated in the wdt? watchdog timer mode, and the wdt? tcnt overflows, the chip enters the power- on reset state. the pin function controller (pfc) registers and i/o port registers are not initialized by the reset signal generated by the wdt (these registers are only initialized by a power-on reset from off- chip). if reset caused by the input signal at the res pin and a reset caused by wdt overflow occur simultaneously, the res pin reset has priority, and the wovf bit in rstcsr is cleared to 0. when wdt-initiated power-on reset processing is started, the cpu operates as follows: 1. the initial value (execution start address) of the program counter (pc) is fetched from the exception processing vector table. 2. the initial value of the stack pointer (sp) is fetched from the exception processing vector table. 3. the vector base register (vbr) is cleared to h'00000000 and the interrupt mask bits (i3-i0) of the status register (sr) are set to h'f (1111). 4. the values fetched from the exception processing vector table are set in the pc and sp, and the program begins executing. 5.2.3 manual reset when a setting is made for a manual reset to be generated in the wdt? watchdog timer mode, and the wdt? tcnt overflows, the chip enters the power-on reset state. when wdt-initiated manual reset processing is started, the cpu operates as follows: 1. the initial value (execution start address) of the program counter (pc) is fetched from the exception processing vector table. 2. the initial value of the stack pointer (sp) is fetched from the exception processing vector table. 3. the vector base register (vbr) is cleared to h'00000000 and the interrupt mask bits (i3-i0) of the status register (sr) are set to h'f (1111). 4. the values fetched from the exception processing vector table are set in the pc and sp, and the program begins executing. in a manual reset the bus cycle is retained, but if a manual reset occurs while the bus is released or during dmac burst transfer, manual reset exception processing will be deferred until the cpu acquires the bus. however, if the interval from generation of the manual reset until the end of the bus cycle is equal to or longer than the internal manual reset interval of 512 cycles, the internal manual reset source is ignored instead of being deferred, and manual reset exception processing is not executed.
67 5.3 address errors 5.3.1 address error sources address errors occur when instructions are fetched or data read or written, as shown in table 5.6. table 5.6 bus cycles and address errors bus cycle type bus master bus cycle description address errors instruction cpu instruction fetched from even address none (normal) fetch instruction fetched from odd address address error occurs instruction fetched from other than on-chip peripheral module space* none (normal) instruction fetched from on-chip peripheral module space* address error occurs instruction fetched from external memory space when in single chip mode address error occurs data cpu or word data accessed from even address none (normal) read/write dmac word data accessed from odd address address error occurs longword data accessed from a longword boundary none (normal) longword data accessed from other than a long-word boundary address error occurs byte or word data accessed in on-chip peripheral module space* none (normal) longword data accessed in 16-bit on-chip peripheral module space* none (normal) longword data accessed in 8-bit on-chip peripheral module space* address error occurs external memory space accessed when in single chip mode address error occurs note: * see section 8, bus state controller, for details of the on-chip peripheral module space.
68 5.3.2 address error exception processing when an address error occurs, the bus cycle in which the address error occurred ends. when the executing instruction then finishes, address error exception processing starts up. the cpu operates as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the start address of the instruction to be executed after the last executed instruction. 3. the exception service routine start address is fetched from the exception processing vector table that corresponds to the address error that occurred and the program starts executing from that address. the jump that occurs is not a delayed branch. 5.4 interrupts 5.4.1 interrupt sources table 5.7 shows the sources that start up interrupt exception processing. these are divided into nmi, user breaks, irq and on-chip peripheral modules. table 5.7 interrupt sources type request source number of sources nmi nmi pin (external input) 1 user break user break controller 1 irq irq0 irq3 each interrupt source is allocated a different vector number and vector table offset. see table 6.3, interrupt exception processing vectors and priorities, in section 6, interrupt controller, for more information on vector numbers and vector table address offsets.
69 5.4.2 interrupt priority level the interrupt priority order is predetermined. when multiple interrupts occur simultaneously (overlap), the interrupt controller (intc) determines their relative priorities and starts up processing according to the results. the priority order of interrupts is expressed as priority levels 0 to 16, with priority 0 the lowest and priority 16 the highest. the nmi interrupt has priority 16 and cannot be masked, so it is always accepted. the user break interrupt and h-udi interrupt priority level is 15. irq interrupts and on-chip peripheral module interrupt priority levels can be set freely using the intc? interrupt priority registers a, c to l (ipra, iprc to iprl) as shown in table 5.8. the priority levels that can be set are 0 to 15. level 16 cannot be set. see section 6.3.1, interrupt priority registers a, c to l (ipra, iprc to iprl), for details of the interrupt priority registers. table 5.8 interrupt priority order type priority level comment nmi 16 fixed priority level. cannot be masked. user break 15 fixed priority level. irq 0 to 15 set with interrupt priority level setting registers a and c through l (ipra, iprc to iprl). on-chip peripheral module 0 to 15 set with interrupt priority level setting registers a and c through l (ipra, iprc to iprl). 5.4.3 interrupt exception processing when an interrupt occurs, its priority level is ascertained by the interrupt controller (intc). nmi is always accepted, but other interrupts are only accepted if they have a priority level higher than the priority level set in the interrupt mask bits (i3 to i0) of the status register (sr). when an interrupt is accepted, exception processing begins. in interrupt exception processing, the cpu saves sr and the program counter (pc) to the stack. the priority level value of the accepted interrupt is written to sr bits i3 to i0. for nmi, however, the priority level is 16, but the value set in i3 to i0 is h'f (level 15). next, the start address of the exception service routine is fetched from the exception processing vector table for the accepted interrupt, that address is jumped to and execution begins. see section 6.4, interrupt operation, for further details.
70 5.5 exceptions triggered by instructions 5.5.1 types of exceptions triggered by instructions exception processing can be triggered by trap instructions, general illegal instructions, and illegal slot instructions, as shown in table 5.9. table 5.9 types of exceptions triggered by instructions type source instruction comment trap instructions trapa illegal slot instructions undefined code placed immediately after a delayed branch instruction (delay slot) and instructions that rewrite the pc delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, braf instructions that rewrite the pc: jmp, jsr, bra, bsr, rts, rte, bt, bf, trapa, bf/s, bt/s, bsrf, braf general illegal instructions undefined code anywhere besides in a delay slot 5.5.2 trap instructions when a trapa instruction is executed, trap instruction exception processing starts up. the cpu operates as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the start address of the instruction to be executed after the trapa instruction. 3. the exception service routine start address is fetched from the exception processing vector table that corresponds to the vector number specified in the trapa instruction. that address is jumped to and the program starts executing. the jump that occurs is not a delayed branch.
71 5.5.3 illegal slot instructions an instruction placed immediately after a delayed branch instruction is said to be placed in a delay slot. when the instruction placed in the delay slot is undefined code, illegal slot exception processing starts up when that undefined code is decoded. illegal slot exception processing also starts up when an instruction that rewrites the program counter (pc) is placed in a delay slot. the processing starts when the instruction is decoded. the cpu handles an illegal slot instruction as follows: 1. the status register (sr) is saved to the stack. 2. the program counter (pc) is saved to the stack. the pc value saved is the jump address of the delayed branch instruction immediately before the undefined code or the instruction that rewrites the pc. 3. the exception service routine start address is fetched from the exception processing vector table that corresponds to the exception that occurred. that address is jumped to and the program starts executing. the jump that occurs is not a delayed branch. 5.5.4 general illegal instructions when undefined code placed anywhere other than immediately after a delayed branch instruction (i.e., in a delay slot) is decoded, general illegal instruction exception processing starts up. the cpu handles general illegal instructions in the same way as illegal slot instructions. unlike processing of illegal slot instructions, however, the program counter value stored is the start address of the undefined code.
72 5.6 when exception sources are not accepted when an address error or interrupt is generated after a delayed branch instruction or interrupt- disabled instruction, it is sometimes not accepted immediately but stored instead, as shown in table 5.10. when this happens, it will be accepted when an instruction that can accept the exception is decoded. table 5.10 generation of exception sources immediately after a delayed branch instruction or interrupt-disabled instruction exception source point of occurrence bus error interrupt fpu exception immediately after a delayed branch instruction* 1 not accepted not accepted not accepted immediately after an interrupt-disabled instruction* 2 not accepted* 3 not accepted accepted notes: 1. delayed branch instructions: jmp, jsr, bra, bsr, rts, rte, bf/s, bt/s, bsrf, braf 2. interrupt-disabled instructions: ldc, ldc.l, stc, stc.l, lds, lds.l, sts, sts.l 3. in the sh-2 a bus error is accepted.
73 5.7 stack status after exception processing ends the status of the stack after exception processing ends is as shown in table 5.11. table 5.11 stack status after exception processing ends exception type stack status address error 32 bits 32 bits sr address of instruction after executed instruction sp trap instruction 32 bits 32 bits sr address of instruction after trapa instruction sp general illegal instruction 32 bits 32 bits sr start address of illegal instruction sp interrupt 32 bits 32 bits sr address of instruction after executed instruction sp illegal slot instruction 32 bits 32 bits sr jump destination address of delay branch instruction sp
74 5.8 usage notes 5.8.1 value of stack pointer (sp) the value of the stack pointer must always be a multiple of four. if it is not, an address error will occur when the stack is accessed during exception processing. 5.8.2 value of vector base register (vbr) the value of the vector base register must always be a multiple of four. if it is not, an address error will occur when the stack is accessed during exception processing. 5.8.3 address errors caused by stacking of address error exception processing when the stack pointer is not a multiple of four, an address error will occur during stacking of the exception processing (interrupts, etc.) and address error exception processing will start up as soon as the first exception processing is ended. address errors will then also occur in the stacking for this address error exception processing. to ensure that address error exception processing does not go into an endless loop, no address errors are accepted at that point. this allows program control to be shifted to the address error exception service routine and enables error processing. when an address error occurs during exception processing stacking, the stacking bus cycle (write) is executed. during stacking of the status register (sr) and program counter (pc), the sp is decremented by 4 for both, so the value of sp will not be a multiple of four after the stacking either. the address value output during stacking is the sp value, so the address where the error occurred is itself output. this means the write data stacked will be undefined.
75 section 6 interrupt controller (intc) 6.1 overview the interrupt controller (intc) ascertains the priority of interrupt sources and controls interrupt requests to the cpu. the intc has registers for setting the priority of each interrupt which can be used by the user to order the priorities in which the interrupt requests are processed. 6.1.1 features the intc has the following features: ? 16 levels of interrupt priority by setting the twelve interrupt-priority level registers, the priorities of irq interrupts and on- chip peripheral module interrupts can be set in 16 levels for different request sources. ? nmi noise canceler function nmi input level bits indicate the nmi pin status. by reading these bits with the interrupt exception service routine, the pin status can be confirmed, enabling it to be used as a noise canceler.
76 6.1.2 block diagram figure 6.1 is a block diagram of the intc. cpu sr interrupt request com- parator cpu/ dmac request judg- ment priority ranking judg- ment input control (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) isr icr ipr ipra, iprc to iprl module bus bus interface internal bus i3 i2 i1 i0 intc irqout irq0 irq1 irq2 irq3 figure 6.1 intc block diagram
77 6.1.3 pin configuration table 6.1 shows the intc pin configuration. table 6.1 pin configuration name abbreviation i/o function non-maskable interrupt input pin nmi i input of non-maskable interrupt request signal interrupt request input pins irq0 irq3 6.1.4 register configuration the intc has the 14 registers shown in table 6.2. these registers set the priority of the interrupts and control external interrupt input signal detection. table 6.2 register configuration name abbr. r/w initial value address access sizes interrupt priority register a ipra r/w h'0000 h'ffff ed00 8, 16, 32 interrupt priority register c iprc r/w h'0000 h'ffff ed04 8, 16, 32 interrupt priority register d iprd r/w h'0000 h'ffff ed06 8, 16, 32 interrupt priority register e ipre r/w h'0000 h'ffff ed08 8, 16, 32 interrupt priority register f iprf r/w h'0000 h'ffff ed0a 8, 16, 32 interrupt priority register g iprg r/w h'0000 h'ffff ed0c 8, 16, 32 interrupt priority register h iprh r/w h'0000 h'ffff ed0e 8, 16, 32 interrupt priority register i ipri r/w h'0000 h'ffff ed10 8, 16, 32 interrupt priority register j iprj r/w h'0000 h'ffff ed12 8, 16, 32 interrupt priority register k iprk r/w h'0000 h'ffff ed14 8, 16, 32 interrupt priority register l iprl r/w h'0000 h'ffff ed16 8, 16, 32 interrupt control register icr r/w * 1 h'ffff ed18 8, 16, 32 irq status register isr r(w) * 2 h'0000 h'ffff ed1a 8, 16, 32 notes: three access cycles are required for byte access and word access, and six cycles for longword access. 1. the value when the nmi pin is high is h'8000; when the nmi pin is low, it is h'0000. 2. only 0 can be written, in order to clear flags.
78 6.2 interrupt sources there are five types of interrupt sources: nmi, user breaks, h-udi, irq, and on-chip peripheral modules. each interrupt has a priority expressed as a priority level (0 to 16, with 0 the lowest and 16 the highest). giving an interrupt a priority level of 0 masks it. 6.2.1 nmi interrupts the nmi interrupt has priority 16 and is always accepted. input at the nmi pin is detected by edge. use the nmi edge select bit (nmie) in the interrupt control register (icr) to select either the rising or falling edge. nmi interrupt exception processing sets the interrupt mask level bits (i3 to i0) in the status register (sr) to level 15. 6.2.2 user break interrupt a user break interrupt has a priority of level 15, and occurs when the break condition set in the user break controller (ubc) is satisfied. user break interrupt requests are detected by edge and are held until accepted. user break interrupt exception processing sets the interrupt mask level bits (i3 to i0) in the status register (sr) to level 15. for more information about the user break interrupt, see section 7, user break controller. 6.2.3 irq interrupts irq interrupts are requested by input from pins irq0 to irq3 . set the irq sense select bits (irq0s to irq3s) of the interrupt control register (icr) to select low level detection or falling edge detection for each pin. the priority level can be set from 0 to 15 for each pin using interrupt priority registers a and b (ipra to iprb). when irq interrupts are set to low level detection, an interrupt request signal is sent to the intc during the period the irq pin is low. interrupt request signals are not sent to the intc when the irq pin becomes high. interrupt request levels can be confirmed by reading the irq flags (irq0f to irq3f) of the irq status register (isr). when irq interrupts are set to falling edge detection, interrupt request signals are sent to the intc upon detecting a change on the irq pin from high to low level. irq interrupt request detection results are maintained until the interrupt request is accepted. confirmation that irq interrupt requests have been detected is possible by reading the irq flags (irq0f to irq3f) of the irq status register (isr), and by writing a 0 after reading a 1, irq interrupt request detection results can be withdrawn. in irq interrupt exception processing, the interrupt mask bits (i3 to i0) of the status register (sr) are set to the priority level value of the accepted irq interrupt.
79 6.2.4 on-chip peripheral module interrupts on-chip peripheral module interrupts are interrupts generated by the following on-chip peripheral modules: ? direct memory access controller (dmac) ? advanced timer unit (atu-ii) ? compare match timer (cmt) ? a/d converter (a/d) ? serial communication interface (sci) ? watchdog timer (wdt) ? hitachi controller area network (hcan) a different interrupt vector is assigned to each interrupt source, so the exception service routine does not have to decide which interrupt has occurred. priority levels between 0 and 15 can be assigned to individual on-chip peripheral modules in interrupt priority registers c to l (iprc to iprl). on-chip peripheral module interrupt exception processing sets the interrupt mask level bits (i3 to i0) in the status register (sr) to the priority level value of the on-chip peripheral module interrupt that was accepted. 6.2.5 interrupt exception vectors and priority rankings table 6.3 lists interrupt sources and their vector numbers, vector table address offsets and interrupt priorities. each interrupt source is allocated a different vector number and vector table address offset. vector table addresses are calculated from vector numbers and address offsets. in interrupt exception processing, the exception service routine start address is fetched from the vector table indicated by the vector table address. see table 5.4, calculating exception processing vector table addresses, in section 5, exception processing. irq interrupts and on-chip peripheral module interrupt priorities can be set freely between 0 and 15 for each pin or module by setting interrupt priority registers a and c to l (ipra, iprc to iprl). the ranking of interrupt sources for iprc to iprl, however, must be the order listed under priority within ipr setting range in table 6.3 and cannot be changed. a power-on reset assigns priority level 0 to irq interrupts and on-chip peripheral module interrupts. if the same priority level is assigned to two or more interrupt sources and interrupts from those sources occur simultaneously, their priority order is the default priority order indicated at the right in table 6.3.
80 table 6.3 interrupt exception processing vectors and priorities interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority nmi 11 h'0000002c to h'0000002f 16 high ubc 12 h'00000030 to h'00000033 15 irq0 64 h'00000100 to h'00000103 0 to 15 (0) ipra (15 to 12) irq1 65 h'00000104 to h'00000107 0 to 15 (0) ipra (11 to 8) irq2 66 h'00000108 to h'0000010b 0 to 15 (0) ipra (7 to 4) irq3 67 h'0000010c to h'0000010f 0 to 15 (0) ipra (3 to 0) dmac0 dei0 72 h'00000120 to h'00000123 0 to 15 (0) iprc (15 to 12)
81 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority atu1 atu11 imi1a/ cmi1 96 h'00000180 to h'00000183 0 to 15 (0) iprd (7 to 4)
82 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority atu2 atu21 imi2a/ cmi2a 108 h'000001b0 to h'000001b3 0 to 15 (0) ipre (11 to 8)
83 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority atu4 atu41 imi4a 128 h'00000200 to h'00000203 0 to 15 (0) iprf (7 to 4)
84 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority atu7 cmi7a 148 h'00000250 to h'00000253 0 to 15 (0) iprg (3 to 0)
85 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority atu8 atu84 osi8m 164 h'00000290 to h'00000293 0 to 15 (0) iprh (3 to 0)
86 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority cmt0 cmti0 188 h'000002f0 to h'000002f3 0 to 15 (0) i prj (11 to 8)
87 table 6.3 interrupt exception processing vectors and priorities (cont) interrupt vector interrupt priority interrupt source vector no. vector table address offset priority (initial value) corre- sponding ipr (bits) within ipr setting range default priority sci3 eri3 212 h'00000350 to h'00000353 0 to 15 (0) iprk (3 to 0)
88 6.3 description of registers 6.3.1 interrupt priority registers a, c to l (ipra, iprc to iprl) interrupt priority registers a, c to l (ipra, iprc to iprl) are 16-bit readable/writable registers that set priority levels from 0 to 15 for irq interrupts and on-chip peripheral module interrupts. correspondence between interrupt request sources and each of the ipra, iprc to iprl bits is shown in table 6.4. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 6.4 interrupt request sources and ipra, iprc to iprl bits register 15 to 12 11 to 8 7 to 4 3 to 0 interrupt priority register a irq0 irq1 irq2 irq3 interrupt priority register c dmac0, 1 dmac2, 3 atu01 atu02 interrupt priority register d atu03 atu04 atu11 atu12 interrupt priority register e atu13 atu21 atu22 atu23 interrupt priority register f atu31 atu32 atu41 atu42 interrupt priority register g atu51 atu52 atu6 atu7 interrupt priority register h atu81 atu82 atu83 atu84 interrupt priority register i atu91 atu92 atu101 atu102 interrupt priority register j atu11 cmt0, a/d0 cmt1, a/d1 ? ?
89 as indicated in table 6.4, four irq pins or groups of 4 on-chip peripheral modules are allocated to each register. each of the corresponding interrupt priority ranks are established by setting a value from h'0 (0000) to h'f (1111) in each of the four-bit groups 15 to 12, 11 to 8, 7 to 4 and 3 to 0. interrupt priority rank becomes level 0 (lowest) by setting h'0, and level 15 (highest) by setting h'f. if multiple on-chip peripheral modules are assigned to the same bit (dmac0 and dmac1, dmac2 and dmac3, cmt0 and a/d0, and cmt1 and a/d1), those multiple modules are set to the same priority rank. ipra, iprc to iprl are initialized to h'0000 by a reset and in hardware standby mode. they are not initialized in software standby mode. 6.3.2 interrupt control register (icr) icr is a 16-bit register that sets the input signal detection mode of the external interrupt input pin nmi and irq0 to irq3 and indicates the input signal level at the nmi pin. a reset and hardware standby mode initialize icr but the software standby mode does not. bit: 15 14 13 12 11 10 9 8 nmil nmie initial value: * 0 0 0 0 0 0 0 r/w: r r/w bit: 7 6 5 4 3 2 1 0 irq0s irq1s irq2s irq3s ???? ???? ? bit 15?mi input level (nmil): sets the level of the signal input at the nmi pin. this bit can be read to determine the nmi pin level. this bit cannot be modified. bit 15: nmil description 0 nmi input level is low 1 nmi input level is high ? bits 14 to 9?eserved: these bits always read 0. the write value should always be 0.
90 ? bit 8?mi edge select (nmie) bit 8: nmie description 0 interrupt request is detected on falling edge of nmi input (initial value) 1 interrupt request is detected on rising edge of nmi input ? bits 7 to 4?rq0 to irq3 sense select (irq0s to irq3s): these bits set the irq0 to irq3 interrupt request detection mode. bits 7 to 4: irq0s to irq3s description 0 interrupt request is detected on low level of irq input (initial value) 1 interrupt request is detected on falling edge of irq input ? bits 3 to 0?eserved: these bits always read 0. the write value should always be 0. 6.3.3 irq status register (isr) isr is a 16-bit register that indicates the interrupt request status of the external interrupt input pins irq0 to irq3 . when irq interrupts are set to edge detection, held interrupt requests can be withdrawn by writing 0 to irqnf after reading irqnf = 1. a reset and hardware standby mode initialize isr but software standby mode does not. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 irq0f irq1f irq2f irq3f initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r r r r ? bits 15 to 8?eserved: these bits always read 0. the write value should always be 0.
91 ? bits 7 to 4?rq0 to irq3 flags (irq0f to irq3f): these bits display the irq0 to irq3 interrupt request status. bits 7 to 4: irq0f to irq3f detection setting description 0 level detection no irqn interrupt request exists [clearing condition] when irqn ? ? irqn irqn ? bits 3 to 0?eserved: these bits always read 0. the write value should always be 0.
92 6.4 interrupt operation 6.4.1 interrupt sequence the sequence of interrupt operations is explained below. figure 6.2 is a flowchart of the operations. 1. the interrupt request sources send interrupt request signals to the interrupt controller. 2. the interrupt controller selects the highest priority interrupt in the interrupt requests sent, following the priority levels set in interrupt priority registers a, c to l (ipra, iprc to iprl). lower-priority interrupts are ignored. they are held pending until interrupt requests designated as edge-detect type are accepted. for irq interrupts, however, withdrawal is possible by accessing the irq status register (isr). see section 6.2.3, irq interrupts, for details. interrupts held pending due to edge detection are cleared by a power-on reset or a manual reset. if two of these interrupts have the same priority level or if multiple interrupts occur within a single module, the interrupt with the highest default priority or the highest priority within its ipr setting range (as indicated in table 6.3) is selected. 3. the interrupt controller compares the priority level of the selected interrupt request with the interrupt mask bits (i3 to i0) in the cpu? status register (sr). if the request priority level is equal to or less than the level set in i3 to i0, the request is ignored. if the request priority level is higher than the level in bits i3 to i0, the interrupt controller accepts the interrupt and sends an interrupt request signal to the cpu. 4. the cpu detects the interrupt request sent from the interrupt controller when it decodes the next instruction to be executed. instead of executing the decoded instruction, the cpu starts interrupt exception processing (figure 6.4). 5. sr and pc are saved onto the stack. 6. the priority level of the accepted interrupt is copied to the interrupt mask level bits (i3 to i0) in the status register (sr). 7. the cpu reads the start address of the exception service routine from the exception vector table for the accepted interrupt, jumps to that address, and starts executing the program there. this jump is not a delay branch.
93 no yes nmi? no yes user break? no yes no h-udi interrupt? yes level 15 interrupt? no yes i3 to i0 figure 6.2 interrupt sequence flowchart
94 6.4.2 stack after interrupt exception processing figure 6.3 shows the stack after interrupt exception processing. 32 bits 32 bits pc* 1 sr address 4n 8 4n 4 4n sp* 2 notes: 1. 2. pc: start address of the next instruction (return destination instruction) after the executing instruction always be certain that sp is a multiple of 4 figure 6.3 stack after interrupt exception processing
95 6.5 interrupt response time table 6.5 indicates the interrupt response time, which is the time from the occurrence of an interrupt request until the interrupt exception processing starts and fetching of the first instruction of the interrupt service routine begins. figure 6.4 shows an example of pipeline operation when an irq interrupt is accepted. table 6.5 interrupt response time number of states item nmi, peripheral module irq notes dmac activation judgment 0 or 1 0 1 state required for interrupt signals for which dmac activation is possible compare identified inter- rupt priority with sr mask level 23 wait for completion of sequence currently being executed by cpu x (
96 fde mee mme ee fd f 3 3 interrupt acceptance irq m1 m2 1 m3 1 5 + m1 + m2 + m3 instruction (instruction replaced by interrupt exception processing) overrun fetch interrupt service routine start instruction f: d: e: m: instruction fetch (instruction fetched from memory where program is stored). instruction decoding (fetched instruction is decoded). instruction execution (data operation and address calculation is performed according to the results of decoding). memory access (data in memory is accessed). figure 6.4 example of pipeline operation when an irq interrupt is accepted
97 6.6 data transfer with interrupt request signals the following data transfer can be carried out using interrupt request signals: ? activate dmac only, without generating cpu interrupt among interrupt sources, those designated as dmac activating sources are masked and not input to the intc. the masking condition is as follows: mask condition = dme (de0 source selection 0 + de1 source selection 1 + de2 source selection 2 + de3 source selection 3) 6.6.1 handling cpu interrupt sources, but not dmac activating sources 1. either do not select the dmac as a source, or clear the dme bit to 0. 2. activating sources are applied to the cpu when interrupts occur. 3. the cpu clears interrupt sources with its interrupt processing routine and performs the necessary processing. 6.6.2 handling dmac activating sources but not cpu interrupt sources 1. select the dmac as a source and set the dme bit to 1. cpu interrupt sources are masked regardless of the interrupt priority level register settings. 2. activating sources are applied to the dmac when interrupts occur. 3. the dmac clears activating sources at the time of data transfer.
98
99 section 7 user break controller (ubc) 7.1 overview the user break controller (ubc) provides functions that simplify program debugging. break conditions are set in the ubc and a user break interrupt is generated according to the conditions of the bus cycle generated by the cpu or dmac. this function makes it easy to design an effective self-monitoring debugger, enabling the chip to easily debug programs without using a large in- circuit emulator. 7.1.1 features the features of the user break controller are: ? the following break compare conditions can be set: ? address ? cpu cycle/dma cycle ? instruction fetch or data access ? read or write ? operand size: byte/word/longword ? user break interrupt generated upon satisfying break conditions a user-designed user break interrupt exception processing routine can be run. ? select either to break in the cpu instruction fetch cycle before the instruction is executed or after. ? satisfaction of a break condition can be output to the ubctrg pin.
100 7.1.2 block diagram figure 7.1 shows a block diagram of the ubc. module bus ubbr ubamrh ubamrl ubarh ubarl break condition comparator user break interrupt generating circuit bus interface internal bus interrupt request interrupt controller trigger output generating circuit ubcr ubctrg figure 7.1 user break controller block diagram
101 7.1.3 register configuration the ubc has the six registers shown in table 7.1. break conditions are established using these registers. table 7.1 register configuration name abbr. r/w initial value address* access size user break address register h ubarh r/w h'0000 h'ffffec00 8, 16, 32 user break address register l ubarl r/w h'0000 h'ffffec02 8, 16, 32 user break address mask register h ubamrh r/w h'0000 h'ffffec04 8, 16, 32 user break address mask register l ubamrl r/w h'0000 h'ffffec06 8, 16, 32 user break bus cycle register ubbr r/w h'0000 h'ffffec08 8, 16, 32 user break control register ubcr r/w h'0000 h'ffffec0a 8, 16, 32 note: * in register access, three cycles are required for byte access and word access, and six cycles for longword access. 7.2 register descriptions 7.2.1 user break address register (ubar) ubarh: bit: 15 14 13 12 11 10 9 8 uba31 uba30 uba29 uba28 uba27 uba26 uba25 uba24 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 uba23 uba22 uba21 uba20 uba19 uba18 uba17 uba16 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
102 ubarl: bit: 15 14 13 12 11 10 9 8 uba15 uba14 uba13 uba12 uba11 uba10 uba9 uba8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 uba7 uba6 uba5 uba4 uba3 uba2 uba1 uba0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the user break address register (ubar) consists of user break address register h (ubarh) and user break address register l (ubarl). both are 16-bit readable/writable registers. ubarh stores the upper bits (bits 31 to 16) of the address of the break condition, while ubarl stores the lower bits (bits 15 to 0). ubarh and ubarl are initialized to h'0000 by a power-on reset and in module standby mode. they are not initialized in software standby mode. ? ubarh bits 15 to 0?ser break address 31 to 16 (uba31 to uba16): these bits store the upper bit values (bits 31 to 16) of the address of the break condition. ? ubarl bits 15 to 0?ser break address 15 to 0 (uba15 to uba0): these bits store the lower bit values (bits 15 to 0) of the address of the break condition. 7.2.2 user break address mask register (ubamr) ubamrh: bit: 15 14 13 12 11 10 9 8 ubm31 ubm30 ubm29 ubm28 ubm27 ubm26 ubm25 ubm24 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ubm23 ubm22 ubm21 ubm20 ubm19 ubm18 ubm17 ubm16 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
103 ubamrl: bit: 15 14 13 12 11 10 9 8 ubm15 ubm14 ubm13 ubm12 ubm11 ubm10 ubm9 ubm8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ubm7 ubm6 ubm5 ubm4 ubm3 ubm2 ubm1 ubm0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the user break address mask register (ubamr) consists of user break address mask register h (ubamrh) and user break address mask register l (ubamrl). both are 16-bit readable/writable registers. ubamrh designates whether to mask any of the break address bits established in ubarh, and ubamrl designates whether to mask any of the break address bits established in ubarl. ubamrh and ubamrl are initialized to h'0000 by a power-on reset and in module standby mode. they are not initialized in software standby mode. ? ubamrh bits 15 to 0?ser break address mask 31 to 16 (ubm31 to ubm16): these bits designate whether to mask the corresponding break address 31 to 16 bits (uba31 to uba16) established in ubarh. ? ubamrl bits 15 to 0?ser break address mask 15 to 0 (ubm15 to ubm0): these bits designate whether to mask the corresponding break address 15 to 0 bits (uba15 to uba0) established in ubarl. bit 15 to 0: ubmn description 0 break address uban is included in the break conditions (initial value) 1 break address uban is not included in the break conditions note: n = 31 to 0
104 7.2.3 user break bus cycle register (ubbr) bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 cp1 cp0 id1 id0 rw1 rw0 sz1 sz0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the user break bus cycle register (ubbr) is a 16-bit readable/writable register that selects from among the following four break conditions: 1. cpu cycle/dma cycle 2. instruction fetch/data access 3. read/write 4. operand size (byte, word, longword) ubbr is initialized to h'0000 by a power on reset and in module standby mode. it is not initialized in software standby mode. ? bits 15 to 8?eserved: these bits always read 0. the write value should always be 0. ? bits 7 and 6?pu cycle/dma cycle select (cp1, cp0): these bits designate break conditions for cpu cycles or dma cycles. bit 7: cp1 bit 6: cp0 description 0 0 no user break interrupt occurs (initial value) 1 break on cpu cycles 1 0 break on dma cycles 1 break on both cpu and dma cycles
105 ? bits 5 and 4?nstruction fetch/data access select (id1, id0): these bits select whether to break on instruction fetch and/or data access cycles. bit 5: id1 bit 4: id0 description 0 0 no user break interrupt occurs (initial value) 1 break on instruction fetch cycles 1 0 break on data access cycles 1 break on both instruction fetch and data access cycles ? bits 3 and 2?ead/write select (rw1, rw0): these bits select whether to break on read and/or write cycles. bit 3: rw1 bit 2: rw0 description 0 0 no user break interrupt occurs (initial value) 1 break on read cycles 1 0 break on write cycles 1 break on both read and write cycles ? bits 1 and 0?perand size select (sz1, sz0): these bits select operand size as a break condition. bit 1: sz1 bit 0: sz0 description 0 0 operand size is not a break condition (initial value) 1 break on byte access 1 0 break on word access 1 break on longword access note: when breaking on an instruction fetch, clear the sz0 bit to 0. all instructions are considered to be word-size accesses (even when there are instructions in on-chip memory and two instruction fetches are performed simultaneously in one bus cycle). operand size is word for instructions or determined by the operand size specified for the cpu/dmac data access. it is not determined by the bus width of the space being accessed.
106 7.2.4 user break control register (ubcr) bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ? ? ? ? ? cks1 cks0 ubid initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r/w r/w r/w the user break control register (ubcr) is a 16-bit readable/writable register that (1) enables or disables user break interrupts and (2) sets the pulse width of the ubctrg signal output in the event of a break condition match. ubcr is initialized to h'0000 by a power-on reset and in module standby mode. it is not initialized in software standby mode. ? bits 15 to 3?eserved: these bits always read 0. the write value should always be 0. ? bits 2 and 1?lock select 1 and 0 (cks1, cks0): these bits specify the pulse width of the ubctrg signal output in the event of a condition match. bit 2: cks1 bit 1: cks0 description 00 ubctrg ubctrg ubctrg ubctrg ? bit 0?ser break disable (ubid): enables or disables user break interrupt request generation in the event of a user break condition match. bit 0: ubid description 0 user break interrupt request is enabled (initial value) 1 user break interrupt request is disabled
107 7.3 operation 7.3.1 flow of the user break operation the flow from setting of break conditions to user break interrupt exception processing is described below: 1. the user break addresses are set in the user break address register (ubar), the desired masked bits in the addresses are set in the user break address mask register (ubamr) and the breaking bus cycle type is set in the user break bus cycle register (ubbr). if even one of the three groups of the ubbr? cpu cycle/dma cycle select bits (cp1, cp0), instruction fetch/data access select bits (id1, id0), and read/write select bits (rw1, rw0) is set to 00 (no user break generated), no user break interrupt will be generated even if all other conditions are in agreement. when using user break interrupts, always be certain to establish bit conditions for all of these three groups. 2. the ubc uses the method shown in figure 7.2 to judge whether set conditions have been fulfilled. when the set conditions are satisfied, the ubc sends a user break interrupt request signal to the interrupt controller (intc). at the same time, a condition match signal is output at the ubctrg pin with the pulse width set in bits cks1 and cks0. 3. the interrupt controller checks the accepted user break interrupt request signal? priority level. the user break interrupt has priority level 15, so it is accepted only if the interrupt mask level in bits i3 to i0 in the status register (sr) is 14 or lower. when the i3 to i0 bit level is 15, the user break interrupt cannot be accepted but it is held pending until user break interrupt exception processing can be carried out. consequently, user break interrupts within nmi exception service routines cannot be accepted, since the i3 to i0 bit level is 15. however, if the i3 to i0 bit level is changed to 14 or lower at the start of the nmi exception service routine, user break interrupts become acceptable thereafter. section 6, interrupt controller, describes the handling of priority levels in greater detail. 4. the intc sends the user break interrupt request signal to the cpu, which begins user break interrupt exception processing upon receipt. see section 6.4, interrupt operation, for details on interrupt exception processing.
108 sz1 sz0 user break interrupt rw1 rw0 id1 id0 cp1 cp0 ubarh/ubarl ubamrh/ubamrl ubid 32 32 32 32 32 internal address bits 31 to 0 cpu cycle dma cycle instruction fetch data access read cycle write cycle byte size word size longword size figure 7.2 break condition judgment method
109 7.3.2 break on on-chip memory instruction fetch cycle on-chip memory (on-chip rom and/or ram) is always accessed as 32 bits in one bus cycle. therefore, two instructions can be retrieved in one bus cycle when fetching instructions from on- chip memory. at such times, only one bus cycle is generated, but by setting the start addresses of both instructions in the user break address register (ubar) it is possible to cause independent breaks. in other words, when wanting to effect a break using the latter of two addresses retrieved in one bus cycle, set the start address of that instruction in ubar. the break will occur after execution of the former instruction. 7.3.3 program counter (pc) values saved break on instruction fetch: the program counter (pc) value saved to the stack in user break interrupt exception processing is the address that matches the break condition. the user break interrupt is generated before the fetched instruction is executed. if a break condition is set in an instruction fetch cycle placed immediately after a delayed branch instruction (delay slot), or on an instruction that follows an interrupt-disabled instruction, however, the user break interrupt is not accepted immediately, but the break condition establishing instruction is executed. the user break interrupt is accepted after execution of the instruction that has accepted the interrupt. in this case, the pc value saved is the start address of the instruction that will be executed after the instruction that has accepted the interrupt. break on data access (cpu/dma): the program counter (pc) value is the top address of the next instruction after the last instruction executed before the user break exception processing started. when data access (cpu/dma) is set as a break condition, the place where the break will occur cannot be specified exactly. the break will occur at the instruction fetched close to where the data access that is to receive the break occurs.
110 7.4 examples of use 7.4.1 break on cpu instruction fetch cycle 1. register settings: ubarh = h'0000 ubarl = h'0404 ubbr = h'0054 ubcr = h'0000 conditions set: address: h'00000404 bus cycle: cpu, instruction fetch, read (operand size not included in conditions) interrupt requests enabled a user break interrupt will occur before the instruction at address h'00000404. if it is possible for the instruction at h'00000402 to accept an interrupt, the user break exception processing will be executed after execution of that instruction. the instruction at h'00000404 is not executed. the pc value saved is h'00000404. 2. register settings: ubarh = h'0015 ubarl = h'389c ubbr = h'0058 ubcr = h'0000 conditions set: address: h'0015389c bus cycle: cpu, instruction fetch, write (operand size not included in conditions) interrupt requests enabled a user break interrupt does not occur because the instruction fetch cycle is not a write cycle. 3. register settings: ubarh = h'0003 ubarl = h'0147 ubbr = h'0054 ubcr = h'0000 conditions set: address: h'00030147 bus cycle: cpu, instruction fetch, read (operand size not included in conditions) interrupt requests enabled a user break interrupt does not occur because the instruction fetch was performed for an even address. however, if the first instruction fetch address after the branch is an odd address set by these conditions, user break interrupt exception processing will be carried out after address error exception processing.
111 7.4.2 break on cpu data access cycle 1. register settings: ubarh = h'0012 ubarl = h'3456 ubbr = h'006a ubcr = h'0000 conditions set: address: h'00123456 bus cycle: cpu, data access, write, word interrupt requests enabled a user break interrupt occurs when word data is written into address h'00123456. 2. register settings: ubarh = h'00a8 ubarl = h'0391 ubbr = h'0066 ubcr = h'0000 conditions set: address: h'00a80391 bus cycle: cpu, data access, read, word interrupt requests enabled a user break interrupt does not occur because the word access was performed on an even address. 7.4.3 break on dma cycle 1. register settings: ubarh = h'0076 ubarl = h'bcdc ubbr = h'00a7 ubcr = h'0000 conditions set: address: h'0076bcdc bus cycle: dma, data access, read, longword interrupt requests enabled a user break interrupt occurs when longword data is read from address h'0076bcdc. 2. register settings: ubarh = h'0023 ubarl = h'45c8 ubbr = h'0094 ubcr = h'0000 conditions set: address: h'002345c8 bus cycle: dma, instruction fetch, read (operand size not included in conditions) interrupt requests enabled a user break interrupt does not occur because no instruction fetch is performed in the dma cycle.
112 7.5 usage notes 7.5.1 simultaneous fetching of two instructions two instructions may be simultaneously fetched from on-chip memory. if a break condition is set on the second of these two instructions but the contents of the ubc break condition registers are changed so as to alter the break condition immediately after the first of the two instructions is fetched, a user break interrupt will still occur when the second instruction is fetched. 7.5.2 instruction fetch at branches when a conditional branch instruction or trapa instruction causes a branch, instructions are fetched and executed as follows: 1. conditional branch instruction, branch taken: bt, bf trapa instruction, branch taken: trapa instruction fetch order: branch instruction fetch next instruction overrun fetch overrun fetch of instruction after next branch destination instruction fetch instruction execution order: branch instruction execution branch destination instruction execution 2. when branching with a delayed conditional instruction: bt/s and bf/s instructions instruction fetch order: branch instruction fetch next instruction fetch (delay slot) overrun fetch of instruction after next branch destination instruction fetch instruction execution order: branch instruction execution delay slot instruction execution branch destination instruction execution when a conditional branch instruction or trapa instruction causes a branch, the branch destination will be fetched after the next instruction or the one after that performs an overrun fetch. however, because the instruction that is the object of the break first breaks after a definite instruction fetch and execution, the kind of overrun fetch instructions noted above do not become objects of a break. if data access breaks are also included with instruction fetch breaks as break conditions, a break occurs because the instruction overrun fetch is also regarded as becoming a data break.
113 7.5.3 contention between user break and exception processing if a user break is set for the fetch of a particular instruction, and exception processing with higher priority than a user break is in contention and is accepted in the decode stage for that instruction (or the next instruction), user break exception processing may not be performed after completion of the higher-priority exception service routine (on return by rte). thus, if a user break condition is applied to the branch destination instruction fetch after a branch (bra, braf, bt, bf, bt/s, bf/s, bsr, bsrf, jmp, jsr, rts, rte, exception processing), and that branch instruction accepts exception processing with higher priority than a user break interrupt, user break exception processing is not performed after completion of the higher-priority exception service routine. therefore, a user break condition should not be set for the fetch of the branch destination instruction after a branch. 7.5.4 break at non-delay branch instruction jump destination when a branch instruction with no delay slot (including exception processing) jumps to the jump destination instruction on execution of the branch, a user break will not be generated even if a user break condition has been set for the first jump destination instruction fetch. 7.5.5 user break trigger output information on internal bus condition matches monitored by the ubc is output as ubctrg . the trigger width can be set with clock select bits 1 and 0 (cks1, cks0) in the user break control register (ubcr). if a condition matches occurs again during trigger output, the ubctrg pin continues to output a low level, and outputs a pulse of the length set in bits cks1 and cks0 from the cycle in which the last condition match occurs. the trigger output conditions differ from those in the case of a user break interrupt when a cpu instruction fetch condition is satisfied. when a condition occurs in an overrun fetch instruction as described in section 7.5.2, instruction fetch at branches, a user break interrupt is not requested but a trigger is output from the ubctrg pin. in other cpu data accesses and dmac bus cycles, pulse output is performed under conditions similar to user break interrupt conditions. setting the user break interrupt disable (ubid) bit to 1 in ubcr enables trigger output to be monitored externally without requesting a user break interrupt.
114 7.5.6 module standby after a power-on reset the ubc is in the module standby state, in which the clock supply is halted. when using the ubc, the module standby state must be cleared before making ubc register settings. module standby is controlled by the module standby control register (mstcr). see section 23.2.3, module standby control register, for further details.
115 section 8 bus state controller (bsc) 8.1 overview the bus state controller (bsc) divides up the address spaces and outputs control for various types of memory. this enables memories like sram and rom to be linked directly to the chip without external circuitry, simplifying system design and enabling high-speed data transfer to be achieved in a compact system. 8.1.1 features the bsc has the following features: ? address space is divided into four spaces ? a maximum linear 2 mbytes for on-chip rom effective mode, and a maximum 4 mbytes for on-chip rom disabled mode, for address space cs0 ? a maximum linear 4 mbytes for each of address spaces cs1 to cs3 ? bus width can be selected for each space (8 or 16 bits) ? wait states can be inserted by software for each space ? wait state insertion with wait pin in external memory space access ? outputs control signals for each space according to the type of memory connected ? on-chip rom and ram interfaces ? on-chip rom and ram access of 32 bits in 1 state
116 8.1.2 block diagram figure 8.1 shows the bsc block diagram. ramer wcr bcr1 bcr2 internal bus module bus bus interface on-chip memory control unit memory control unit wait control unit area control unit wrh wrl cs0 cs3 rd wait figure 8.1 bsc block diagram
117 8.1.3 pin configuration table 8.1 shows the bus state controller pin configuration. table 8.1 pin configuration name abbr. i/o description address bus a21 to a0 o address output data bus d15 to d0 i/o 16-bit data bus chip select cs0 cs3 rd wrh wrl wait breq back wrl wrh wrl 8.1.4 register configuration the bsc has four registers. these registers are used to control wait states, bus width, and interfaces with memories like rom and sram, as well as refresh control. the register configurations are listed in table 8.2. all registers are 16 bits. all bsc registers are all initialized by a power-on reset and in hardware standby mode. values are retained in a manual reset and in software standby mode.
118 table 8.2 register configuration name abbr. r/w initial value address access size bus control register 1 bcr1 r/w h'000f h'ffffec20 8, 16, 32 bus control register 2 bcr2 r/w h'ffff h'ffffec22 8, 16, 32 wait state control register wcr r/w h'ffff h'ffffec24 8, 16, 32 ram emulation register ramer r/w h'0000 h'ffffec26 8, 16, 32 note: in register access, three cycles are required for byte access and word access, and six cycles for longword access. 8.1.5 address map figure 8.2 shows the address format used by the sh7052f/sh7053f/sh7054f. a31 to a24 a23, a22 a21 output address: output from the address pins space selection: not output externally; used to select the type of space on-chip rom space or cs0 to cs3 space when 00000000 (h'00) reserved (do not access) when 00000001 to 11111110 (h'01 to h'fe) on-chip peripheral module space or on-chip ram space when 11111111 (h'ff) cs space selection: decoded, outputs cs0 cs3 figure 8.2 address format this chip uses 32-bit addresses: ? bits a31 to a24 are used to select the type of space and are not output externally. ? bits a23 and a22 are decoded and output as chip select signals ( cs0 to cs3 ) for the corresponding areas when bits a31 to a24 are 00000000. ? a21 to a0 are output externally.
119 tables 8.3, 8.4 and 8.5 show the address map. table 8.3 address map ? on-chip rom enabled mode (sh7052f) address space memory size bus width h'0000 0000 to h'0003 ffff on-chip rom on-chip rom 256 kb 32 bits h'0004 0000 to h'001f ffff reserved reserved h'0020 0000 to h'003f ffff cs0 space external space 2 mb 8, 16 bits * 1 h'0040 0000 to h'007f ffff cs1 space external space 4 mb 8, 16 bits * 1 h'0080 0000 to h'00bf ffff cs2 space external space 4 mb 8, 16 bits * 1 h'00c0 0000 to h'00ff ffff cs3 space external space 4 mb 8, 16 bits * 1 h'0100 0000 to h'ffff 7fff reserved reserved h'ffff 8000 to h'ffff afff on-chip ram on-chip ram 12 kb 32 bits h'ffff b000 to h'ffff dfff reserved reserved h'ffff e000 to h'ffff ffff on-chip peripheral module on-chip peripheral module 8 kb 8, 16 bits ? on-chip rom disabled mode (sh7052f) address space memory size bus width h'0000 0000 to h'003f ffff cs0 space external space 4 mb 8, 16 bits * 2 h'0040 0000 to h'007f ffff cs1 space external space 4 mb 8, 16 bits * 1 h'0080 0000 to h'00bf ffff cs2 space external space 4 mb 8, 16 bits * 1 h'00c0 0000 to h'00ff ffff cs3 space external space 4 mb 8, 16 bits * 1 h'0100 0000 to h'ffff 7fff reserved reserved h'ffff 8000 to h'ffff afff on-chip ram on-chip ram 12 kb 32 bits h'ffff b000 to h'ffff dfff reserved reserved h'ffff e000 to h'ffff ffff on-chip peripheral module on-chip peripheral module 8 kb 8, 16 bits notes: do not access reserved spaces. operation cannot be guaranteed if they are accessed. 1. selected by on-chip register (bcr1) settings. 2. selected by the mode pin.
120 table 8.4 address map ? on-chip rom enabled mode (sh7053f) address space memory size bus width h'0000 0000 to h'0003 ffff on-chip rom on-chip rom 256 kb 32 bits h'0004 0000 to h'001f ffff reserved reserved h'0020 0000 to h'003f ffff cs0 space external space 2 mb 8, 16 bits * 1 h'0040 0000 to h'007f ffff cs1 space external space 4 mb 8, 16 bits * 1 h'0080 0000 to h'00bf ffff cs2 space external space 4 mb 8, 16 bits * 1 h'00c0 0000 to h'00ff ffff cs3 space external space 4 mb 8, 16 bits * 1 h'0100 0000 to h'ffff 7fff reserved reserved h'ffff 8000 to h'ffff bfff on-chip ram on-chip ram 12 kb 32 bits h'ffff c000 to h'ffff dfff reserved reserved h'ffff e000 to h'ffff ffff on-chip peripheral module on-chip peripheral module 8 kb 8, 16 bits ? on-chip rom disabled mode (sh7053f) address space memory size bus width h'0000 0000 to h'003f ffff cs0 space external space 4 mb 8, 16 bits * 2 h'0040 0000 to h'007f ffff cs1 space external space 4 mb 8, 16 bits * 1 h'0080 0000 to h'00bf ffff cs2 space external space 4 mb 8, 16 bits * 1 h'00c0 0000 to h'00ff ffff cs3 space external space 4 mb 8, 16 bits * 1 h'0100 0000 to h'ffff 7fff reserved reserved h'ffff 8000 to h'ffff bfff on-chip ram on-chip ram 16 kb 32 bits h'ffff b000 to h'ffff dfff reserved reserved h'ffff e000 to h'ffff ffff on-chip peripheral module on-chip peripheral module 8 kb 8, 16 bits notes: do not access reserved spaces. operation cannot be guaranteed if they are accessed. 1. selected by on-chip register (bcr1) settings. 2. selected by the mode pin.
121 table 8.5 address map ? on-chip rom enabled mode (sh7054f) address space memory size bus width h'0000 0000 to h'0005 ffff on-chip rom on-chip rom 384 kb 32 bits h'0006 0000 to h'001f ffff reserved reserved h'0020 0000 to h'003f ffff cs0 space external space 2 mb 8, 16 bits * 1 h'0040 0000 to h'007f ffff cs1 space external space 4 mb 8, 16 bits * 1 h'0080 0000 to h'00bf ffff cs2 space external space 4 mb 8, 16 bits * 1 h'00c0 0000 to h'00ff ffff cs3 space external space 4 mb 8, 16 bits * 1 h'0100 0000 to h'ffff 7fff reserved reserved h'ffff 8000 to h'ffff bfff on-chip ram on-chip ram 16 kb 32 bits h'ffff c000 to h'ffff dfff reserved reserved h'ffff e000 to h'ffff ffff on-chip peripheral module on-chip peripheral module 8 kb 8, 16 bits ? on-chip rom disabled mode (sh7054f) address space memory size bus width h'0000 0000 to h'003f ffff cs0 space external space 4 mb 8, 16 bits * 2 h'0040 0000 to h'007f ffff cs1 space external space 4 mb 8, 16 bits * 1 h'0080 0000 to h'00bf ffff cs2 space external space 4 mb 8, 16 bits * 1 h'00c0 0000 to h'00ff ffff cs3 space external space 4 mb 8, 16 bits * 1 h'0100 0000 to h'ffff 7fff reserved reserved h'ffff 8000 to h'ffff bfff on-chip ram on-chip ram 16 kb 32 bits h'ffff c000 to h'ffff dfff reserved reserved h'ffff e000 to h'ffff ffff on-chip peripheral module on-chip peripheral module 8 kb 8, 16 bits notes: do not access reserved spaces. operation cannot be guaranteed if they are accessed. 1. selected by on-chip register (bcr1) settings. 2. selected by the mode pin.
122 8.2 description of registers 8.2.1 bus control register 1 (bcr1) bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ? ? ? ? a3sz a2sz a1sz a0sz initial value: 0 0 0 0 1 1 1 1 r/w: r r r r r/w r/w r/w r/w bcr1 is a 16-bit readable/writable register that specifies the bus size of the cs spaces. write bits 15 to 0 of bcr1 during the initialization stage after a power-on reset, and do not change the values thereafter. in on-chip rom enabled mode, do not access any of the cs spaces until after completion of register initialization. in on-chip rom disabled mode, do not access any cs space other than cs0 until after completion of register initialization. bcr1 is initialized to h'000f by a power-on reset and in hardware standby mode. it is not initialized by a manual reset or in software standby mode. ? bits 15 to 4?eserved: these bits always read 0. operation cannot be guaranteed if 1 is written to these bits. ? bit 3?s3 space size specification (a3sz): specifies the cs3 space bus size. a 0 setting specifies byte (8-bit) size, and a 1 setting specifies word (16-bit) size. bit 3: a3sz description 0 byte (8-bit) size 1 word (16-bit) size (initial value) ? bit 2?s2 space size specification (a2sz): specifies the cs2 space bus size. a 0 setting specifies byte (8-bit) size, and a 1 setting specifies word (16-bit) size. bit 2: a2sz description 0 byte (8-bit) size 1 word (16-bit) size (initial value)
123 ? bit 1?s1 space size specification (a1sz): specifies the cs1 space bus size. a 0 setting specifies byte (8-bit) size, and a 1 setting specifies word (16-bit) size. bit 1: a1sz description 0 byte (8-bit) size 1 word (16-bit) size (initial value) ? bit 0?s0 space size specification (a0sz): specifies the cs0 space bus size a 0 setting specifies byte (8-bit) size, and a 1 setting specifies word (16-bit) size. bit 0: a0sz description 0 byte (8-bit) size 1 word (16-bit) size (initial value) note: a0sz is valid only in on-chip rom enabled mode. in on-chip rom disabled mode, the cs0 space bus size is specified by the mode pin. 8.2.2 bus control register 2 (bcr2) bit: 15 14 13 12 11 10 9 8 iw31 iw30 iw21 iw20 iw11 iw10 iw01 iw00 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 cw3 cw2 cw1 cw0 sw3 sw2 sw1 sw0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bcr2 is a 16-bit readable/writable register that specifies the number of idle cycles and cs signal assert extension of each cs space. bcr2 is initialized to h'ffff by a power-on reset and in hardware standby mode. it is not initialized by a manual reset or in software standby mode. ? bits 15 to 8?dles between cycles (iw31, iw30, iw21, iw20, iw11, iw10, iw01, iw00): these bits specify idle cycles inserted between consecutive accesses when the second one is to a different cs area after a read. idles are used to prevent data conflict between rom (and other memories, which are slow to turn the read data buffer off), fast memories, and i/o interfaces. even when access is to the same area, idle cycles must be inserted when a read access is followed immediately by a write access. the idle cycles to be inserted comply with
124 the area specification of the previous access . refer to section 8.4, waits between access cycles, for details. iw31 and iw30 specify the idle between cycles for cs3 space; iw21 and iw20 specify the idle between cycles for cs2 space; iw11 and iw10 specify the idle between cycles for cs1 space and iw01 and iw00 specify the idle between cycles for cs0 space. bit 15: iw31 bit 14: iw30 description 0 0 no cs3 space idle cycle 1 inserts one idle cycle 1 0 inserts two idle cycles 1 inserts three idle cycles (initial value) bit 13: iw21 bit 12: iw20 description 0 0 no cs2 space idle cycle 1 inserts one idle cycle 1 0 inserts two idle cycles 1 inserts three idle cycles (initial value) bit 11: iw11 bit 10: iw10 description 0 0 no cs1 space idle cycle 1 inserts one idle cycle 1 0 inserts two idle cycles 1 inserts three idle cycles (initial value) bit 9: iw01 bit 8: iw00 description 0 0 no cs0 space idle cycle 1 inserts one idle cycle 1 0 inserts two idle cycles 1 inserts three idle cycles (initial value) ? bits 7 to 4?dle specification for continuous access (cw3, cw2, cw1, cw0): the continuous access idle specification makes insertions to clearly delineate the bus intervals by once negating the csn signal when performing consecutive accesses to the same cs space. when a write immediately follows a read, the number of idle cycles inserted is the larger of the two values specified by iw and cw. refer to section 8.4, waits between access cycles, for details.
125 cw3 specifies the continuous access idles for cs3 space; cw2 specifies the continuous access idles for cs2 space; cw1 specifies the continuous access idles for cs1 space and cw0 specifies the continuous access idles for cs0 space. bit 7: cw3 description 0 no cs3 space continuous access idle cycles 1 one cs3 space continuous access idle cycle (initial value) bit 6: cw2 description 0 no cs2 space continuous access idle cycles 1 one cs2 space continuous access idle cycle (initial value) bit 5: cw1 description 0 no cs1 space continuous access idle cycles 1 one cs1 space continuous access idle cycle (initial value) bit 4: cw0 description 0 no cs0 space continuous access idle cycles 1 one cs0 space continuous access idle cycle (initial value) ? bits 3 to 0 cs assert extension specification (sw3, sw2, sw1, sw0): the cs assert cycle extension specification is for making insertions to prevent extension of the rd signal, wrh signal, or wrl signal assert period beyond the length of the csn signal assert period. extended cycles insert one cycle before and after each bus cycle, which simplifies interfaces with external devices and also has the effect of extending the write data hold time. refer to section 8.3.3, cs assert period extension, for details. sw3 specifies the cs assert extension for cs3 space access; sw2 specifies the cs assert extension for cs2 space access; sw1 specifies the cs assert extension for cs1 space access and sw0 specifies the cs assert extension for cs0 space access. bit 3: sw3 description 0 no cs3 space cs cs bit 2: sw2 description 0 no cs2 space cs cs
126 bit 1: sw1 description 0 no cs1 space cs cs bit 0: sw0 description 0 no cs0 space cs cs 8.2.3 wait control register (wcr) bit: 15 14 13 12 11 10 9 8 w33 w32 w31 w30 w23 w22 w21 w20 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 w13 w12 w11 w10 w03 w02 w01 w00 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w wcr is a 16-bit readable/writable register that specifies the number of wait cycles for each cs space. wcr1 is initialized to h'ffff by a power-on reset and in hardware standby mode. it is not initialized by a manual reset or in software standby mode. ? bits 15 to 12?s3 space wait specification (w33, w32, w31, w30): these bits specify the number of waits for cs3 space access. bit 15: w33 bit 14: w32 bit 13: w31 bit 12: w30 description 0000no wait (external wait input disabled) 00011 wait external wait input enabled ???
127 ? bits 11 to 8?s2 space wait specification (w23, w22, w21, w20): these bits specify the number of waits for cs2 space access. bit 11: w23 bit 10: w22 bit 9: w21 bit 8: w20 description 0000no wait (external wait input disabled) 00011 wait external wait input enabled ??? ? bits 7 to 4?s1 space wait specification (w13, w12, w11, w10): these bits specify the number of waits for cs1 space access. bit 7: w13 bit 6: w12 bit 5: w11 bit 4: w10 description 0000no wait (external wait input disabled) 00011 wait external wait input enabled ??? ? bits 3 to 0?s0 space wait specification (w03, w02, w01, w00): these bits specify the number of waits for cs0 space access. bit 3: w03 bit 2: w02 bit 1: w01 bit 0: w00 description 0000no wait (external wait input disabled) 00011 wait external wait input enabled ???
128 8.2.4 ram emulation register (ramer) bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ? ? ? ? rams ram2 ram1 ram0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w the ram emulation register (ramer) is a 16-bit readable/writable register that selects the ram area to be used when emulating realtime programming of flash memory. ramer is initialized to h'0000 by a power-on reset and in hardware standby mode. it is not initialized by a manual reset or in software standby mode. note: to ensure correct operation of the ram emulation function, the rom for which ram emulation is performed should not be accessed immediately after this register has been modified. operation cannot be guaranteed if such an access is made. ? bits 15 to 4?eserved: only 0 should be written to these bits. operation cannot be guaranteed if 1 is written. ? bit 3?am select (rams): used together with bits 2 to 0 to select or deselect flash memory emulation by ram (table 8.6). when 1 is written to this bit, all flash memory blocks are write/erase-protected. this bit is ignored in modes with on-chip rom disabled. ? bits 2 to 0?am area specification (ram2 to ram0): these bits are used together with the rams bit to designate the flash memory area to be overlapped onto ram (table 8.6).
129 table 8.6 ram area setting method ram area bit 3: rams bit 2: ram2 bit 1: ram1 bit 0: ram0 h'ffff8000 to h'ffff8fff 0 *** h'00000000 to h'00000fff 1000 h'00001000 to h'00001fff 1001 h'00002000 to h'00002fff 1010 h'00003000 to h'00003fff 1011 h'00004000 to h'00004fff 1100 h'00005000 to h'00005fff 1101 h'00006000 to h'00006fff 1110 h'00007000 to h'00007fff 1111 * : don? care
130 8.3 accessing external space a strobe signal is output in external space accesses to provide primarily for sram or rom direct connections. 8.3.1 basic timing figure 8.3 shows the basic timing of external space access. external access bus cycles are performed in 2 states. t 1 ck address csn rd read write data wrh wrl figure 8.3 basic timing of external space access
131 8.3.2 wait state control the number of wait states inserted into external space access states can be controlled using the wcr settings (figure 8.4). the specified number of t w cycles are inserted as software cycles at the timing shown in figure 8.4. t 1 t w ck read write address csn rd wrh wrl figure 8.4 wait state timing of external space access (software wait only)
132 when the wait is specified by software using wcr, the wait input wait signal from outside is sampled. figure 8.5 shows the wait signal sampling. the wait signal is sampled at the clock rise one cycle before the clock rise when the t w state shifts to the t 2 state. when using external waits, use a wcr setting of 1 state or more when extending cs assertion, and 2 states or more otherwise. t 1 t w ck read write address csn wait rd wrh wrl figure 8.5 wait state timing of external space access (two software wait states + wait signal wait state)
133 8.3.3 cs assert period extension idle cycles can be inserted to prevent extension of the rd , wrh , or wrl signal assert period beyond the length of the csn signal assert period by setting the sw3 to sw0 bits of bcr2. this allows for flexible interfaces with external circuitry. the timing is shown in figure 8.6. t h and t f cycles are added respectively before and after the ordinary cycle. only csn is asserted in these cycles; rd , wrh, and wrl signals are not. further, data is extended up to the t f cycle, which is effective for gate arrays and the like, which have slower write operations. t h t 1 ck read write address csn rd wrh wrl figure 8.6 cs assert period extension function
134 8.4 waits between access cycles when a read from a slow device is completed, data buffers may not go off in time to prevent data conflicts with the next access. if there is a data conflict during memory access, the problem can be solved by inserting a wait in the access cycle. to enable detection of bus cycle starts, waits can be inserted between access cycles during continuous accesses of the same cs space by negating the csn signal once. 8.4.1 prevention of data bus conflicts for the two cases of write cycles after read cycles, and read cycles for a different area after read cycles, waits are inserted so that the number of idle cycles specified by the iw31 to iw00 bits of bcr2 occur. when idle cycles already exist between access cycles, only the number of empty cycles remaining beyond the specified number of idle cycles are inserted. figure 8.7 shows an example of idles between cycles. in this example, one idle between csn space cycles has been specified, so when a csm space write immediately follows a csn space read cycle, one idle cycle is inserted. ck csn csm rd wrh wrl figure 8.7 idle cycle insertion example
135 iw31 and iw30 specify the number of idle cycles required after a cs3 space read either to read other external spaces, or for this chip, to perform write accesses. in the same manner, iw21 and iw20 specify the number of idle cycles after a cs2 space read, iw11 and iw10, the number after a cs1 space read, and iw01 and iw00, the number after a cs0 space read. 0 to 3 idle cycles can be specified. 8.4.2 simplification of bus cycle start detection for consecutive accesses of the same cs space, waits are inserted so that the number of idle cycles designated by the cw3 to cw0 bits of bcr2 occur. however, for write cycles after reads, the number of idle cycles inserted will be the larger of the two values defined by the iw and cw bits. when idle cycles already exist between access cycles, waits are not inserted. figure 8.8 shows an example. a continuous access idle is specified for csn space, and csn space is consecutively write-accessed. ck csn rd wrh wrl figure 8.8 same space consecutive access idle cycle insertion example
136 8.5 bus arbitration the sh7052f/sh7053f/sh7054f has a bus arbitration function that, when a bus release request is received from an external device, releases the bus to that device. the sh7052f/sh7053f/sh7054f also has three internal bus masters, the cpu, dmac, and aud. the priority ranking for determining bus right transfer between these bus masters is: bus right request from external device > aud > dmac > cpu therefore, an external device that generates a bus request is given priority even if the request is made during a dmac burst transfer. the aud does not acquire the bus during dmac burst transfer, but at the end of the transfer. when the cpu has possession of the bus, the aud has higher priority than the dmac for bus acquisition. a bus request by an external device should be input at the breq pin. the signal indicating that the bus has been released is output from the back pin. figure 8.9 shows the bus right release procedure. breq breq back back figure 8.9 bus right release procedure
137 8.6 memory connection examples figures 8.10 to 8.13 show examples of the memory connections. sh7052f, sh7053f, sh7054f 32 k ce oe csn rd figure 8.10 example of 8-bit data bus width rom connection sh7052f, sh7053f, sh7054f 256 k ce oe csn rd figure 8.11 example of 16-bit data bus width rom connection sh7052f, sh7053f, sh7054f csn rd wrl we ce oe figure 8.12 example of 8-bit data bus width sram connection
138 sh7052f, sh7053f, sh7054f 128 k csn rd cs oe wrh we / wrl cs oe we / figure 8.13 example of 16-bit data bus width sram connection
139 section 9 direct memory access controller (dmac) 9.1 overview the sh7052f/sh7053f/sh7054f includes an on-chip four-channel direct memory access controller (dmac). the dmac can be used in place of the cpu to perform high-speed data transfers among external memories, memory-mapped external devices, and on-chip peripheral modules (except for the dmac, bsc, and ubc). using the dmac reduces the burden on the cpu and increases the operating efficiency of the chip as a whole. 9.1.1 features the dmac has the following features: ? four channels ? 4-gbyte address space in the architecture ? 8-, 16-, or 32-bit selectable data transfer length ? maximum of 16 m (6,777,216) transfers ? address modes both the transfer source and transfer destination are accessed by address. there are two transfer modes: direct address and indirect address. ? direct address transfer mode: values set in a dmac internal register indicate the accessed address for both the transfer source and transfer destination. two bus cycles are required for one data transfer. ? indirect address transfer mode: the value stored at the location pointed to by the address set in the dmac internal transfer source register is used as the address. operation is otherwise the same as for direct access. this function can only be set for channel 3. four bus cycles are required for one data transfer. ? channel function: dual address mode is supported on all channels. channel 2 has a source address reload function that reloads the source address every fourth transfer. direct address transfer mode or indirect address transfer mode can be specified for channel 3. ? reload function enables automatic reloading of the value set in the first source address register every fourth dma transfer. this function can be executed on channel 2 only. ? transfer requests there are two dmac transfer activation requests, as indicated below. ? requests from on-chip peripheral modules: transfer requests from on-chip modules such as the sci or a/d. these can be received by all channels. ? auto-request: the transfer request is generated automatically within the dmac.
140 ? selectable bus modes: cycle-steal mode or burst mode ? fixed dmac channel priority ranking ? cpu can be interrupted when the specified number of data transfers are complete. 9.1.2 block diagram figure 9.1 is a block diagram of the dmac. on-chip rom peripheral bus internal bus on-chip ram hcan circuit control sarn dmac module register control activation control request priority control bus interface external bus bus state controller on-chip peripheral module darn dmatcrn chcrn dmaor atu-ii sci0 to sci4 a/d converter 0, 1 dein external rom external ram external i/o (memory mapped) sarn: darn: dmatcrn: chcrn: dmaor: n: dmac source address register dmac destination address register dmac transfer count register dmac channel control register dmac operation register 0, 1, 2, 3 figure 9.1 dmac block diagram
141 9.1.3 register configuration table 9.1 summarizes the dmac registers. the dmac has a total of 17 registers. each channel has four registers, and one overall dmac control register is shared by all channels. table 9.1 dmac registers channel name abbr. r/w initial value address register size access size 0 dma source address register 0 sar0 r/w undefined h'ffffecc0 32 bits 16, 32* 2 dma destination address register 0 dar0 r/w undefined h'ffffecc4 32 bits 16, 32* 2 dma transfer count register 0 dmatcr0 r/w undefined h'ffffecc8 32 bits 16, 32* 2 dma channel control register 0 chcr0 r/w* 1 h'00000000 h'ffffeccc 32 bits 16, 32* 2 1 dma source address register 1 sar1 r/w undefined h'ffffecd0 32 bits 16, 32* 2 dma destination address register 1 dar1 r/w undefined h'ffffecd4 32 bits 16, 32* 2 dma transfer count register 1 dmatcr1 r/w undefined h'ffffecd8 32 bits 16, 32* 3 dma channel control register 1 chcr1 r/w* 1 h'00000000 h'ffffecdc 32 bits 16, 32* 2 2 dma source address register 2 sar2 r/w undefined h'ffffece0 32 bits 16, 32* 2 dma destination address register 2 dar2 r/w undefined h'ffffece4 32 bits 16, 32* 2 dma transfer count register 2 dmatcr2 r/w undefined h'ffffece8 32 bits 16, 32* 3 dma channel control register 2 chcr2 r/w* 1 h'00000000 h'ffffecec 32 bits 16, 32* 2
142 table 9.1 dmac registers (cont) channel name abbr. r/w initial value address register size access size 3 dma source address register 3 sar3 r/w undefined h'ffffecf0 32 bits 16, 32* 2 dma destination address register 3 dar3 r/w undefined h'ffffecf4 32 bits 16, 32* 2 dma transfer count register 3 dmatcr3 r/w undefined h'ffffecf8 32 bits 16, 32* 3 dma channel control register 3 chcr3 r/w* 1 h'00000000 h'ffffecfc 32 bits 16, 32* 2 shared dma operation register dmaor r/w* 1 h'0000 h'ffffecb0 16 bits 16* 4 notes: word access to a register takes 3 cycles, and longword access 6 cycles. 1. write 0 after reading 1 in bit 1 of chcr0 to chcr3 and in bits 1 and 2 of dmaor to clear flags. no other writes are allowed. 2. for 16-bit access of sar0 to sar3, dar0 to dar3, and chcr0 to chcr3, the 16-bit value on the side not accessed is held. 3. dmatcr has a 24-bit configuration: bits 0 to 23. writing to the upper 8 bits (bits 24 to 31) is invalid, and these bits always read 0. 4. do not use 32-bit access on dmaor. 5. do not attempt to access an empty address, as operation canot be guaranteed if this is done. 9.2 register descriptions 9.2.1 dma source address registers 0 to 3 (sar0 to sar3) dma source address registers 0 to 3 (sar0 to sar3) are 32-bit readable/writable registers that specify the source address of a dma transfer. these registers have a count function, and during a dma transfer, they indicate the next source address. specify a 16-bit boundary when performing 16-bit data transfers, and a 32-bit boundary when performing 32-bit data transfers. operation cannot be guaranteed if any other addresses are set. the initial value after a power-on reset and in standby mode is undefined.
143 bit: 31 30 29 28 27 26 25 24 initial value: ? ? ? ? ? ? ? ? r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 2 1 0 initial value: ? ? ? ? ? ? r/w: r/w r/w r/w r/w r/w r/w 9.2.2 dma destination address registers 0 to 3 (dar0 to dar3) dma destination address registers 0 to 3 (dar0 to dar3) are 32-bit readable/writable registers that specify the destination address of a dma transfer. these registers have a count function, and during a dma transfer, they indicate the next destination address. specify a 16-bit boundary when performing 16-bit data transfers, and a 32-bit boundary when performing 32-bit data transfers. operation cannot be guaranteed if any other addresses are set. the value after a power-on reset and in standby mode is undefined. bit: 31 30 29 28 27 26 25 24 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 23 22 21 2 1 0 initial value: r/w: r/w r/w r/w r/w r/w r/w
144 9.2.3 dma transfer count registers 0 to 3 (dmatcr0 to dmatcr3) dma transfer count registers 0 to 3 (dmatcr0 to dmatcr3) are 24-bit read/write registers that specify the transfer count for the channel (byte count, word count, or longword count) in bits 23 to 0. specifying h'000001 gives a transfer count of 1, while h'000000 gives the maximum setting, 16,777,216 transfers. during dmac operation, these registers indicate the remaining number of transfers. the upper 8 bits of dmatcr always read 0. the write value, also, should always be 0. the value after a power-on reset and in standby mode is undefined. bit: 31 30 29 28 27 26 25 24 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 23 22 21 20 19 18 17 16 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: r/w: r/w r/w r/w r/w r/w r/w r/w r/w
145 9.2.4 dma channel control registers 0 to 3 (chcr0 to chcr3) dma channel control registers 0 to 3 (chcr0 to chcr3) are 32-bit readable/writable registers that designate the operation and transmission of each channel. chcr register bits are initialized to 0 by a power-on reset and in standby mode. bit: 31 30 29 28 27 26 25 24 ?iro initial value: 0 0 0 0 0 0 0 0 r/w: r r r r/w* 2 r r r r/w* 2 bit: 23 22 21 20 19 18 17 16 rs4 rs3 rs2 rs1 rs0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r/w r/w r/w r/w* 1 r/w bit: 15 14 13 12 11 10 9 8 sm1 sm0 dm1 dm0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r r r/w r/w bit: 7 6 5 4 3 2 1 0 ts1 ts0 tm ie te de initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/(w)* 1 r/w notes: 1. te bit: allows only a 0 write after reading 1. 2. the di and ro bits may be absent, depending on the channel.
146 ? bits 31 to 29, 27 to 25, 23 to 21, 15, 14, 11, 10, 7, 6?eserved: these bits are always read as 0, and should only be written with 0. ? bit 28?irect/indirect select (di): specifies either direct address mode operation or indirect address mode operation for the channel 3 source address. this bit is valid only in chcr3. it always reads 0 in chcr0 to chcr2, and should always be written with 0. bit 28: di description 0 direct access mode operation for channel 3 (initial value) 1 indirect access mode operation for channel 3 ? bit 24?ource address reload (ro): selects whether to reload the source address initial value during channel 2 transfer. this bit is valid only for channel 2. it always reads 0 in chcr0, chcr1, and chcr3, and should always be written with 0. bit 24: ro description 0 does not reload source address (initial value) 1 reloads source address
147 ? bits 20 to 16?esource select 4 to 0 (rs4 to rs0): these bits specify the transfer request source. bit 20: rs4 bit 19: rs3 bit 18: rs2 bit 17: rs1 bit 16: rs0 description 00000no request (initial value) 1 sci0 transmission 1 0 sci0 reception 1 sci1 transmission 1 0 0 sci1 reception 1 sci2 transmission 1 0 sci2 reception 1 sci3 transmission 1000 sci3 reception 1 sci4 transmission 1 0 sci4 reception 1 on-chip a/d0 1 0 0 on-chip a/d1 1 no request 1 0 no request 1 hcan (rm) 10000no request 1 atu-ii (ici0a) 1 0 atu-ii (ici0b) 1 atu-ii (ici0c) 1 0 0 atu-ii (ici0d) 1 atu-ii (cmi6a) 1 0 atu-ii (cmi6b) 1 atu-ii (cmi6c) 1000 atu-ii (cmi6d) 1 atu-ii (cmi7a) 1 0 atu-ii (cmi7b) 1 atu-ii (cmi7c) 1 0 0 atu-ii (cmi7d) 1 no request 1 0 no request 1 auto-request
148 ? bits 13 and 12?ource address mode 1 and 0 (sm1, sm0): these bits specify increment/decrement of the dma transfer source address. bit 13: sm1 bit 12: sm0 description 0 0 source address fixed (initial value) 0 1 source address incremented (+1 during 8-bit transfer, +2 during 16-bit transfer, +4 during 32-bit transfer) 1 0 source address decremented (e1 during 8-bit transfer, e2 during 16-bit transfer, e4 during 32-bit transfer) 1 1 setting prohibited when the transfer source is specified at an indirect address, specify in source address register 3 (sar3) the actual storage address of the data to be transferred as the data storage address (indirect address). during indirect address mode, sar3 obeys the sm1/sm0 setting for increment/decrement. in this case, sar3? increment/decrement is fixed at +4/? or 0, irrespective of the transfer data size specified by ts1 and ts0. ? bits 9 and 8?estination address mode 1 and 0 (dm1, dm0): these bits specify increment/decrement of the dma transfer source address. bit 9: dm1 bit 8: dm0 description 0 0 destination address fixed (initial value) 0 1 destination address incremented (+1 during 8-bit transfer, +2 during 16-bit transfer, +4 during 32-bit transfer) 1 0 destination address decremented (e1 during 8-bit transfer, e2 during 16-bit transfer, e4 during 32-bit transfer) 1 1 setting prohibited ? bits 5 and 4?ransfer size 1 and 0 (ts1, ts0): these bits specify the size of the data for transfer. bit 5: ts1 bit 4: ts0 description 0 0 specifies byte size (8 bits) (initial value) 0 1 specifies word size (16 bits) 1 0 specifies longword size (32 bits) 1 1 setting prohibited
149 ? bit 3?ransfer mode (tm): specifies the bus mode for data transfer. bit 3: tm description 0 cycle-steal mode (initial value) 1 burst mode ? bit 2?nterrupt enable (ie): when this bit is set to 1, interrupt requests are generated after the number of data transfers specified in dmatcr (when te = 1). bit 2: ie description 0 interrupt request not generated on completion of dmatcr-specified number of transfers (initial value) 1 interrupt request enabled on completion of dmatcr-specified number of transfers ? bit 1?ransfer end (te): this bit is set to 1 after the number of data transfers specified by dmatcr. at this time, if the ie bit is set to 1, an interrupt request is generated. if data transfer ends before te is set to 1 (for example, due to an nmi or address error, or clearing of the de bit or dme bit of dmaor) te is not set to 1. with this bit set to 1, data transfer is disabled even if the de bit is set to 1. bit 1: te description 0 dmatcr-specified number of transfers not completed (initial value) [clearing condition] 0 write after te = 1 read, power-on reset, standby mode 1 dmatcr-specified number of transfers completed ? bit 0?mac enable (de): de enables operation in the corresponding channel. bit 0: de description 0 operation of the corresponding channel disabled (initial value) 1 operation of the corresponding channel enabled transfer is initiated if this bit is set to 1 when auto-request is specified (rs4 to rs0 settings). with an on-chip module request, when a transfer request occurs after this bit is set to 1, transfer is initiated. if this bit is cleared during a data transfer, transfer is suspended. if the de bit has been set, but te = 1, then if the dme bit of dmaor is 0, and the nmif or ae bit of dmaor is 1, the transfer enable state is not entered.
150 9.2.5 dmac operation register (dmaor) dmaor is a 16-bit readable/writable register that controls the overall operation of the dmac. register values are initialized to 0 by a power-on reset and in standby mode. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ae nmif dme initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r/(w)* r/(w)* r/w note: * a 0 write only is valid after 1 is read at the ae and nmif bits. ? bits 15 to 3?eserved: these bits are always read 0 and should always be written with 0. ? bit 2?ddress error flag (ae): indicates that an address error has occurred during dma transfer. if this bit is set during a data transfer, transfers on all channels are suspended. the cpu cannot write a 1 to the ae bit. clearing is effected by a 0 write after a 1 read. bit 2: ae description 0 no address error, dma transfer enabled (initial value) [clearing condition] write ae = 0 after reading ae = 1 1 address error, dma transfer disabled [setting condition] address error due to dmac
151 ? bit 1?mi flag (nmif): indicates input of an nmi. this bit is set irrespective of whether the dmac is operating or suspended. if this bit is set during a data transfer, transfers on all channels are suspended. the cpu is unable to write a 1 to the nmif. clearing is effected by a 0 write after a 1 read. bit 1: nmif description 0 no nmi interrupt, dma transfer enabled (initial value) [clearing condition] write nmif = 0 after reading nmif = 1 1 nmi has occurred, dmc transfer disabled [setting condition] nmi interrupt occurrence ? bit 0?mac master enable (dme): this bit enables activation of the entire dmac. when the dme bit and de bit of the chcr register for the corresponding channel are set to 1, that channel is transfer-enabled. if this bit is cleared during a data transfer, transfers on all channels are suspended. even when the dme bit is set, when the te bit of chcr is 1, or its de bit is 0, transfer is disabled if the nmif or ae bit in dmaor is set to 1. bit 0: dme description 0 operation disabled on all channels (initial value) 1 operation enabled on all channels
152 9.3 operation when there is a dma transfer request, the dmac starts the transfer according to the channel priority order; when the transfer end conditions are satisfied, it ends the transfer. transfers can be requested in two modes: auto-request and on-chip peripheral module request. transfer is performed only in dual address mode, and either direct or indirect address transfer mode can be used. the bus mode can be either burst or cycle-steal. 9.3.1 dma transfer flow after the dma source address registers (sar), dma destination address registers (dar), dma transfer count register (dmatcr), dma channel control registers (chcr), and dma operation register (dmaor) are set to the desired transfer conditions, the dmac transfers data according to the following procedure: 1. the dmac checks to see if transfer is enabled (de = 1, dme = 1, te = 0, nmif = 0, ae = 0). 2. when a transfer request comes and transfer has been enabled, the dmac transfers 1 transfer unit of data (determined by the ts0 and ts1 setting). for an auto-request, the transfer begins automatically when the de bit and dme bit are set to 1. the dmatcr value will be decremented by 1 upon each transfer. the actual transfer flows vary by address mode and bus mode. 3. when the specified number of transfers have been completed (when dmatcr reaches 0), the transfer ends normally. if the ie bit of chcr is set to 1 at this time, a dei interrupt is sent to the cpu. 4. when an address error occurs in the dmac or an nmi interrupt is generated, the transfer is aborted. transfer is also aborted when the de bit of chcr or the dme bit of dmaor is cleared to 0.
153 figure 9.2 is a flowchart of this procedure. normal end does nmif = 1, ae = 1, de = 0, or dme = 0? bus mode initial settings (sar, dar, dmatcr, chcr, dmaor) transfer (1 transfer unit); dmatcr e 1 dmatcr, sar and dar updated dei interrupt request (when ie = 1) no yes no yes no yes yes no yes no * 3 * 2 start transfer aborted notes: 1. 2. 3. in auto-request mode, transfer begins when nmif, ae, and te are all 0, and the de and dme bits are set to 1. cycle-steal mode burst mode dmatcr = 0? transfer request occurs?* 1 de, dme = 1 and nmif, ae, te = 0? does nmif = 1, ae = 1, de = 0, or dme = 0? transfer ends figure 9.2 dmac transfer flowchart
154 9.3.2 dma transfer requests dma transfer requests are generated in either the data transfer source or destination. transfers can be requested in two modes: auto-request and on-chip peripheral module request. the request mode is selected in the rs4 to rs0 bits of dma channel control registers 0 to 3 (chcr0 to chcr3). auto-request mode: when there is no transfer request signal from an external source, as in a memory-to-memory transfer or a transfer between memory and an on-chip peripheral module unable to request a transfer, the auto-request mode allows the dmac to automatically generate a transfer request signal internally. when the de bits of chcr0 to chcr3 and the dme bit of dmaor are set to 1, the transfer begins (so long as the te bits of chcr0 to chcr3 and the nmif and ae bits of dmaor are all 0). on-chip peripheral module request mode: in this mode a transfer is performed at the transfer request signal (interrupt request signal) of an on-chip peripheral module. as indicated in table 9.2, there are 26 transfer request signals: 12 from the advanced timer unit (atu-ii), which are compare match or input capture interrupts; the receive data full interrupts (rxi) and transmit data empty interrupts (txi) of the five serial communication interfaces (sci); the receive interrupt of hcan; and the a/d conversion end interrupts (adi) of the three a/d converters. when dma transfers are enabled (de = 1, dme = 1, te = 0, nmif = 0, ae = 0), a transfer is performed upon the input of a transfer request signal. when the transfer request is set to rxi (transfer request because the sci? receive data register is full), the transfer source must be the sci? receive data register (rdr). when the transfer request is set to txi (transfer request because the sci? transmit data register is empty), the transfer destination must be the sci? transmit data register (tdr). if the transfer request is set to the a/d converter, the data transfer source must be the a/d converter register; if set to hcan, the transfer source must be hcan message data.
155 table 9.2 selecting on-chip peripheral module request modes with the rs bits rs4 rs3 rs2 rs1 rs0 dmac transfer request source dmac transfer request signal transfer source transfer destination bus mode 00001 sci0 transmit block txi0 (sci0 transmit- data-empty transfer request) don ? t care* tdr0 burst/cycle- steal 1 0 sci0 receive block rxi0 (sci0 receive- data-full transfer request) rdr0 don ? t care* burst/cycle- steal 1 sci1 transmit block txi1 (sci1 transmit- data-empty transfer request) don ? t care* tdr1 burst/cycle- steal 1 0 0 sci1 receive block rxi1 (sci1 receive- data-full transfer request) rdr1 don ? t care* burst/cycle- steal 1 sci2 transmit block txi2 (sci2 transmit- data-empty transfer request) don ? t care* tdr2 burst/cycle- steal 1 0 sci2 receive block rxi2 (sci2 receive- data-full transfer request) rdr2 don ? t care* burst/cycle- steal 1 sci3 transmit block txi3 (sci3 transmit- data-empty transfer request) don ? t care* tdr3 burst/cycle- steal 1000 sci3 receive block rxi3 (sci3 receive- data-full transfer request) rdr3 don ? t care* burst/cycle- steal 1 sci4 transmit block txi4 (sci4 transmit- data-empty transfer request) don ? t care* tdr4 burst/cycle- steal 1 0 sci4 receive block rxi4 (sci4 receive- data-full transfer request) rdr4 don ? t care* burst/cycle- steal 1 a/d0 adi0 (a/d0 conversion end interrupt) addr0 to addr11 don ? t care* burst/cycle- steal 1 0 0 a/d1 adi1 (a/d1 conversion end interrupt) addr12 to addr23 don ? t care* burst/cycle- steal 1 reserved 1 1 hcan rm0 (hcan receive interrupt) md0 to md15 don ? t care* burst/cycle- steal
156 table 9.2 selecting on-chip peripheral module request modes with the rs bits (cont) rs4 rs3 rs2 rs1 rs0 dmac transfer request source dmac transfer request signal transfer source transfer destination bus mode 10001 atu-ii ici0a (icr0a input capture generation) don ? t care* don ? t care* burst/cycle- steal 1 0 atu-ii ici0b (icr0b input capture generation) don ? t care* don ? t care* burst/cycle- steal 1 atu-ii ici0c (icr0c input capture generation) don ? t care* don ? t care* burst/cycle- steal 1 0 0 atu-ii ici0d (icr0d input capture generation) don ? t care* don ? t care* burst/cycle- steal 1 atu-ii cmi6a (cylr6a compare-match generation) don ? t care* don ? t care* burst/cycle- steal 1 0 atu-ii cmi6b (cylr6b compare-match generation) don ? t care* don ? t care* burst/cycle- steal 1 atu-ii cmi6c (cylr6c compare-match generation) don ? t care* don ? t care* burst/cycle- steal 1000 atu-ii cmi6d (cylr6d compare-match generation) don ? t care* don ? t care* burst/cycle- steal 1 atu-ii cmi7a (cylr7a compare-match generation) don ? t care* don ? t care* burst/cycle- steal 1 0 atu-ii cmi7b (cylr7b compare-match generation) don ? t care* don ? t care* burst/cycle- steal 1 atu-ii cmi7c (cylr7c compare-match generation) don ? t care* don ? t care* burst/cycle- steal 1 0 0 atu-ii cmi7d (cylr7d compare-match generation) don ? t care* don ? t care* burst/cycle- steal legend: sci0, sci1, sci2, sci3, sci4: serial communication interface channels 0 to 4 a/d0, a/d1: a/d converter channels 0, 1 hcan: hitachi controller area network channel 0 atu-ii: advanced timer unit tdr0, tdr1, tdr2, tdr3, tdr4: sci0 to sci4 transmit data registers rdr0, rdr1, rdr2, rdr3, rdr4: sci0 to sci4 receive data registers addr0 to addr11: a/d0 data registers
157 addr12 to addr23: a/d1 data registers md0 to md15: hcan message data note: * external memory, memory-mapped external device, on-chip memory, on-chip peripheral module (excluding dmac, bsc, and ubc) 9.3.3 channel priority when the dmac receives simultaneous transfer requests on two or more channels, it selects a channel according to the following priority order: ? ch0 > ch1 > ch2 > ch3 9.3.4 dma transfer types the dmac supports the transfers shown in table 9.3. it operates in dual address mode, in which both the transfer source and destination addresses are output. the dual address mode consists of a direct address mode, in which the output address value is the object of a direct data transfer, and an indirect address mode, in which the output address value is not the object of the data transfer, but the value stored at the output address becomes the transfer object address. the actual transfer operation timing varies with the bus mode. the dmac has two bus modes: cycle-steal mode and burst mode. table 9.3 supported dma transfers transfer destination transfer source external memory memory-mapped external device on-chip memory on-chip peripheral module external memory supported supported supported supported memory-mapped external device supported supported supported supported on-chip memory supported supported supported supported on-chip peripheral module supported supported supported supported 9.3.5 dual address mode dual address mode is used for access of both the transfer source and destination by address. transfer source and destination can be accessed either internally or externally. dual address mode is subdivided into two other modes: direct address transfer mode and indirect address transfer mode.
158 direct address transfer mode: data is read from the transfer source during the data read cycle, and written to the transfer destination during the write cycle, so transfer is conducted in two bus cycles. at this time, the transfer data is temporarily stored in the dmac. with the kind of external memory transfer shown in figure 9.3, data is read from one of the memories by the dmac during a read cycle, then written to the other external memory during the subsequent write cycle. figure 9.4 shows the timing for this operation. data buffer address bus data bus address bus data bus memory transfer source module transfer destination module memory transfer source module transfer destination module sar dar data buffer sar dar the sar value is taken as the address, and data is read from the transfer source module and stored temporarily in the dmac. 1st bus cycle 2nd bus cycle the dar value is taken as the address, and data stored in the dmac's data buffer is written to the transfer destination module. dmac dmac figure 9.3 direct address operation in dual address mode
159 transfer destination address transfer source address ck a21 to a0 csn d15 to d0 rd wrh, wrl figure 9.4 direct address transfer timing in dual address mode indirect address transfer mode: in this mode the memory address storing the data actually to be transferred is specified in the dmac internal transfer source address register (sar3). therefore, in indirect address transfer mode, the dmac internal transfer source address register value is read first. this value is first stored in the dmac. next, the read value is output as the address, and the value stored at that address is again stored in the dmac. finally, the subsequent read value is written to the address specified by the transfer destination address register, ending one cycle of dmac transfer. in indirect address mode (figure 9.5), the transfer destination, transfer source, and indirect address storage destination are all 16-bit external memory locations, and transfer in this example is conducted in 16-bit or 8-bit units. timing for this transfer example is shown in figure 9.6. in indirect address mode, one nop cycle (figure 9.6) is required until the data read as the indirect address is output to the address bus. when transfer data is 32-bit, the third and fourth bus cycles each need to be doubled, giving a required total of six bus cycles and one nop cycle for the whole operation.
160 sar3 dar3 data buffer address bus data bus memory transfer source module transfer destination module temporary buffer the sar3 value is taken as the address, memory data is read, and the value is stored in the temporary buffer. since the value read at this time is used as the address, it must be 32 bits. if the data bus is 16 bits wide when the external memory space is accessed, two bus cycles are necessary. 1st and 2nd bus cycles 3rd bus cycle 4th bus cycle dmac sar3 dar3 data buffer address bus data bus memory transfer source module transfer destination module temporary buffer the value in the temporary buffer is taken as the address, and data is read from the transfer source module to the data buffer. sar3 dar3 data buffer address bus data bus memory transfer source module transfer destination module temporary buffer the dar3 value is taken as the address, and the value in the data buffer is written to the transfer destination module. note: memory, transfer source, and transfer destination modules are shown here. in practice, connection can be made as long as it is within the address space. dmac dmac figure 9.5 dual address mode and indirect address operation (16-bit-width external memory space)
161 ck a21 to a0 d15 to d0 csn wrh , wrl rd data read cycle data write cycle (1st) (2nd) internal address bus internal data bus dmac indirect address buffer dmac data buffer transfer source address (h) transfer source address (l) nop indirect address transfer destina- tion address transfer data nop transfer data indirect address transfer data (4th) (3rd) nop cycle * 2 indirect address (h) indirect address (l) transfer data transfer source address * 1 indirect address transfer data indirect address address read cycle notes: 1. the internal address bus is controlled by the port and does not change. 2. the dmac does not latch the value until 32-bit data is read from the internal data bus. external memory space external memory space (external memory space has 16-bit width) figure 9.6 dual address mode and indirect address transfer timing example 1
162 figure 9.7 shows an example of timing in indirect address mode when transfer source and indirect address storage locations are in internal memory, the transfer destination is an on-chip peripheral module with 2-cycle access space, and transfer data is 8-bit. since the indirect address storage destination and the transfer source are in internal memory, these can be accessed in one cycle. the transfer destination is 2-cycle access space, so two data write cycles are required. one nop cycle is required until the data read as the indirect address is output to the address bus. internal address bus internal data bus dmac indirect address buffer dmac data buffer ck internal memory space internal memory space transfer source address nop nop indirect address transfer destination address indirect address indirect address transfer data transfer data transfer data address read cycle nop cycle data read cycle data write cycle (4th) (1st) (2nd) (3rd) figure 9.7 dual address mode and indirect address transfer timing example 2
163 9.3.6 bus modes select the appropriate bus mode in the tm bits of chcr0 to chcr3. there are two bus modes: cycle-steal and burst. cycle-steal mode: in cycle-steal mode, the bus right is given to another bus master after each one-transfer-unit (8-bit, 16-bit, or 32-bit) dmac transfer. when the next transfer request occurs, the bus right is obtained from the other bus master and a transfer is performed for one transfer unit. when that transfer ends, the bus right is passed to the other bus master. this is repeated until the transfer end conditions are satisfied. cycle-steal mode can be used with all categories of transfer destination, transfer source and transfer request. figure 9.8 shows an example of dma transfer timing in cycle-steal mode. cpu cpu cpu dmac dmac cpu dmac dmac cpu cpu bus cycle bus control returned to cpu read/write read/write figure 9.8 dma transfer timing example in cycle-steal mode burst mode: once the bus right is obtained, transfer is performed continuously until the transfer end condition is satisfied. figure 9.9 shows an example of dma transfer timing in burst mode. cpu cpu cpu dmac dmac dmac dmac dmac read/write read/write read/write bus cycle dmac cpu figure 9.9 dma transfer timing example in burst mode
164 9.3.7 relationship between request modes and bus modes by dma transfer category table 9.4 shows the relationship between request modes and bus modes by dma transfer category. table 9.4 relationship between request modes and bus modes by dma transfer category address mode transfer category request mode bus* 5 mode transfer size (bits) usable channels dual external memory and external memory any* 1 b/c 8/16/32 0 to 3 external memory and memory-mapped external device any* 1 b/c 8/16/32 0 to 3 memory-mapped external device and memory-mapped external device any* 1 b/c 8/16/32 0 to 3 external memory and on-chip memory any* 1 b/c 8/16/32 0 to 3 external memory and on-chip peripheral module any* 2 b/c* 3 8/16/32* 4 0 to 3 memory-mapped external device and on-chip memory any* 1 b/c 8/16/32 0 to 3 memory-mapped external device and on-chip peripheral module any* 2 b/c* 3 8/16/32* 4 0 to 3 on-chip memory and on-chip memory any* 1 b/c 8/16/32 0 to 3 on-chip memory and on-chip peripheral module any* 2 b/c* 3 8/16/32* 4 0 to 3 on-chip peripheral module and on- chip peripheral module any* 2 b/c* 3 8/16/32* 4 0 to 3 b: burst, c: cycle-steal notes: 1. auto-request or on-chip peripheral module request enabled. however, in the case of an on-chip peripheral module request, it is not possible to specify the atu, sci, hcan, or a/d converter for the transfer request source. 2. auto-request or on-chip peripheral module request possible. however, if the transfer request source is the sci, hcan, or a/d converter, the transfer source or transfer destination must be same as the transfer request source. 3. when the transfer request source is the sci, only cycle-steal mode is possible. 4. access size permitted by the on-chip peripheral module register that is the transfer source or transfer destination.
165 9.3.8 bus mode and channel priorities if, for example, a transfer request is issued for channel 0 while transfer is in progress on lower- priority channel 1 in burst mode, transfer is started immediately on channel 0. in this case, if channel 0 is set to burst mode, channel 1 transfer is continued after completion of all transfers on channel 0. if channel 0 is set to cycle-steal mode, channel 1 transfer is continued only if a channel 0 transfer request has not been issued; if a transfer request is issued, channel 0 transfer is started immediately. 9.3.9 source address reload function channel 2 has a source address reload function. this returns to the first value set in the source address register (sar2) every four transfers by setting the ro bit of chcr2 to 1. figure 9.10 illustrates this operation. figure 9.11 is a timing chart for reload on mode, with burst mode, auto- request, 16-bit transfer data size, sar2 increment, and dar2 fixed. sar2 (initial value) dmac transfer request dmac control block reload control 4th count chcr2 dmatcr2 sar2 ro bit = 1 count signal reload signal reload signal address bus figure 9.10 source address reload function
166 ck internal address bus internal data bus sar2 dar2 dar2 dar2 dar2 sar2+2 sar2+4 sar2+6 sar2 dar2 sar2 data sar2+2 data sar2+4 data sar2+6 data sar2 data 1st channel 2 transfer 2nd channel 2 transfer 3rd channel 2 transfer 4th channel 2 transfer 5th channel 2 transfer sar2 output dar2 output sar2+2 output dar2 output sar2+4 output dar2 output sar2+6 output dar2 output sar2 output dar2 output after sar2+6 output, sar2 is reloaded bus right is returned one time in four figure 9.11 source address reload function timing chart the reload function can be executed whether the transfer data size is 8, 16, or 32 bits. dmatcr2, which specifies the number of transfers, is decremented by 1 at the end of every single-transfer-unit transfer, regardless of whether the reload function is on or off. therefore, when using the reload function in the on state, a multiple of 4 must be specified in dmatcr2. operation will not be guaranteed if any other value is set. also, the counter which counts the occurrence of four transfers for address reloading is reset by clearing of the dme bit in dmaor or the de bit in chcr2, setting of the transfer end flag (the te bit in chcr2), nmi input, and setting of the ae flag (address error generation in dmac transfer), as well as by a reset and in software standby mode, but sar2, dar2, dmatcr2, and other registers are not reset. consequently, when one of these sources occurs, there is a mixture of initialized counters and uninitialized registers in the dmac, and incorrect operation may result if a restart is executed in this state. therefore, when one of the above sources, other than te setting, occurs during use of the address reload function, sar, dar2, and dmatcr2 settings must be carried out before re- execution. 9.3.10 dma transfer ending conditions the dma transfer ending conditions vary for individual channels ending and for all channels ending together. individual channel ending conditions: there are two ending conditions. a transfer ends when the value of the channel s dma transfer count register (dmatcr) is 0, or when the de bit of the channel s chcr is cleared to 0.
167 ? when dmatcr is 0: when the dmatcr value becomes 0 and the corresponding channel's dma transfer ends, the transfer end flag bit (te) is set in chcr. if the ie (interrupt enable) bit has been set, a dmac interrupt (dei) request is sent to the cpu. ? when de of chcr is 0: software can halt a dma transfer by clearing the de bit in the channel s chcr. the te bit is not set when this happens. conditions for ending on all channels simultaneously: transfers on all channels end when the nmif (nmi flag) bit or ae (address error flag) bit is set to 1 in dmaor, or when the dme bit in dmaor is cleared to 0. ? when the nmif or ae bit is set to 1 in dmaor: when an nmi interrupt or dmac address error occurs, the nmif or ae bit is set to 1 in dmaor and all channels stop their transfers. the dmac obtains the bus right, and if these flags are set to 1 during execution of a transfer, dmac halts operation when the transfer processing currently being executed ends, and transfers the bus right to the other bus master. consequently, even if the nmif or ae bit is set to 1 during a transfer, the dma source address register (sar), designation address register (dar), and transfer count register (dmatcr) are all updated. the te bit is not set. to resume the transfers after nmi interrupt or address error processing, the nmif or ae flag must be cleared. to avoid restarting a transfer on a particular channel, clear its de bit to 0 in chcr. when the processing of a one-unit transfer is complete: in a dual address mode direct address transfer, even if an address error occurs or the nmi flag is set during read processing, the transfer will not be halted until after completion of the following write processing. in such a case, sar, dar, and dmatcr values are updated. in the same manner, the transfer is not halted in indirect address transfers until after the final write processing has ended. ? when dme is cleared to 0 in dmaor: clearing the dme bit to 0 in dmaor aborts the transfers on all channels. the te bit is not set. 9.3.11 dmac access from cpu the space addressed by the dmac is 3-cycle space. therefore, when the cpu becomes the bus master and accesses the dmac, a minimum of three basic clock cycles are required for one bus cycle. also, since the dmac is located in word space, while a word-size access to the dmac is completed in one bus cycle, a longword-size access is automatically divided into two word accesses, requiring two bus cycles (six basic clock cycles). these two bus cycles are executed consecutively; a different bus cycle is never inserted between the two word accesses. this applies to both write accesses and read accesses.
168 9.4 examples of use 9.4.1 example of dma transfer between on-chip sci and external memory in this example, on-chip serial communication interface channel 0 (sci0) receive data is transferred to external memory using dmac channel 0. table 9.5 indicates the transfer conditions and the set values of each of the registers. table 9.5 transfer conditions and register set values for transfer between on-chip sci and external memory transfer conditions register value transfer source: rdr0 of on-chip sci0 sar0 h'fffff005 transfer destination: external memory dar0 h'00400000 transfer count: 64 times dmatcr0 h'00000040 transfer source address: fixed chcr0 h'00020105 transfer destination address: incremented transfer request source: sci0 (rdr0) bus mode: cycle-steal transfer unit: byte interrupt request generation at end of transfer dmac master enable on dmaor h'0001 9.4.2 example of dma transfer between a/d converter and on-chip memory (address reload on) in this example, on-chip a/d converter channel 0 is the transfer source and on-chip memory is the transfer destination, and the address reload function is on. table 9.6 indicates the transfer conditions and the set values of each of the registers.
169 table 9.6 transfer conditions and register set values for transfer between a/d converter and on-chip memory transfer conditions register value transfer source: on-chip a/d converter ch1 (a/d1) sar2 h'fffff820 transfer destination: on-chip memory dar2 h'ffff6000 transfer count: 128 times (reload count 32 times) dmatcr2 h'00000080 transfer source address: incremented chcr2 h'010c110d transfer destination address: incremented transfer request source: a/d converter ch1 (a/d1) bus mode: burst transfer unit: byte interrupt request generation at end of transfer dmac master enable on dmaor h'0001 when address reload is on, the sar2 value returns to its initially set value every four transfers. in the above example, when a transfer request is input from the a/d1, the byte-size data is first read in from the h'fffff820 register of on-chip a/d1 and that data is written to internal address h'ffff6000. because a byte-size transfer was performed, the sar2 and dar2 values at this point are h'fffff821 and h'ffff6001, respectively. also, because this is a burst transfer, the bus right remains secured, so continuous data transfer is possible. when four transfers are completed, if address reload is off, execution continues with the fifth and sixth transfers and the sar2 value continues to increment from h'fffff824 to h'fffff825 to h'fffff826 and so on. however, when address reload is on, dmac transfer is halted upon completion of the fourth transfer and the bus right request signal to the cpu is cleared. at this time, the value stored in sar2 is not h'fffff823 h'fffff824, but h'fffff823 h'fffff820, a return to the initially set address. the dar2 value always continues to be decremented regardless of whether address reload is on or off. the dmac internal status, due to the above operation after completion of the fourth transfer, is indicated in table 9.7 for both address reload on and off.
170 table 9.7 dmac internal status item address reload on address reload off sar2 h'fffff820 h'fffff824 dar2 h'ffff6004 h'ffff6004 dmatcr2 h'0000007c h'0000007c bus right released retained dmac operation halted processing continues interrupts not issued not issued transfer request source flag clear executed not executed notes: 1. interrupts are executed until the dmatcr2 value becomes 0, and if the ie bit of chcr2 is set to 1, are issued regardless of whether address reload is on or off. 2. if transfer request source flag clears are executed until the dmatcr2 value becomes 0, they are executed regardless of whether address reload is on or off. 3. designate burst mode when using the address reload function. there are cases where abnormal operation will result if it is used in cycle-steal mode. 4. designate a multiple of four for the dmatcr2 value when using the address reload function. there are cases where abnormal operation will result if anything else is designated. to execute transfers after the fifth transfer when address reload is on, have the transfer request source issue another transfer request signal. 9.4.3 example of dma transfer between external memory and sci1 transmitting side (indirect address on) in this example, dmac channel 3 is used, indirect address designated external memory is the transfer source, and the sci1 transmitting side is the transfer destination. table 9.8 indicates the transfer conditions and the set values of each of the registers.
171 table 9.8 transfer conditions and register set values for transfer between external memory and sci1 transmitting side transfer conditions register value transfer source: external memory sar3 h'00400000 value stored in address h'00400000 ? h'00450000 value stored in address h'00450000 ? h'55 transfer destination: on-chip sci tdr1 dar3 h'fffff00b transfer count: 10 times dmatcr3 h'0000000a transfer source address: incremented chcr3 h'10031001 transfer destination address: fixed transfer request source: sci1 (tdr1) bus mode: cycle-steal transfer unit: byte interrupt request not generated at end of transfer dmac master enable on dmaor h'0001 when indirect address mode is on, the data stored in the address set in sar is not used as the transfer source data. in the case of indirect addressing, the value stored in the sar address is read, then that value is used as the address and the data read from that address is used as the transfer source data, then that data is stored in the address designated by dar. in the table 9.8 example, when a transfer request from tdr1 of sci1 is generated, a read of the address located at h'00400000, which is the value set in sar3, is performed first. the data h'00450000 is stored at this h'00400000 address, and the dmac first reads this h'00450000 value. it then uses this read value of h'00450000 as an address and reads the value of h'55 that is stored in the h'00450000 address. it then writes the value h'55 to address h'fffff00b designated by dar3 to complete one indirect address transfer. with indirect addressing, the first executed data read from the address set in sar3 always results in a longword size transfer regardless of the ts0 and ts1 bit designations for transfer data size. however, the transfer source address fixed and increment or decrement designations are according to the sm0 and sm1 bits. consequently, despite the fact that the transfer data size designation is byte in this example, the sar3 value at the end of one transfer is h'00400004. the write operation is exactly the same as an ordinary dual address transfer write operation.
172 9.5 usage notes 1. only word (16-bit) access can be used on the dma operation register (dmaor). all other registers can be accessed in word (16-bit) or longword (32-bit) units. 2. when rewriting the rs0 to rs4 bits of chcr0 to chcr3, first clear the de bit to 0 (clear the de bit to 0 before modifying chcr). 3. when an nmi interrupt is input, the nmif bit of dmaor is set even when the dmac is not operating. 4. clear the dme bit of dmaor to 0 and make certain that any transfer request processing accepted by the dmac has been completed before entering standby mode. 5. do not access the dmac, bsc, or ubc on-chip peripheral modules from the dmac. 6. when activating the dmac, make the chcr settings as the final step. abnormal operation may result if any other registers are set last. 7. after the dmatcr count becomes 0 and the dma transfer ends normally, always write 0 to dmatcr, even when executing the maximum number of transfers on the same channel. abnormal operation may result if this is not done. 8. designate burst mode as the transfer mode when using the address reload function. abnormal operation may result in cycle-steal mode. 9. designate a multiple of four for the dmatcr value when using the address reload function, otherwise abnormal operation may result. 10. do not access empty dmac register addresses. operation cannot be guaranteed when empty addresses are accessed. 11. if dmac transfer is aborted by nmif or ae setting, or dme or de clearing, during dmac execution with address reload on, the sar2, dar2, and dmatcr2 settings should be made before re-executing the transfer. the dmac may not operate correctly if this is not done. 12. do not set the de bit to 1 while bits rs0 to rs4 in chcr0 to chcr3 are still set to no request.
173 section 10 advanced timer unit-ii (atu-ii) 10.1 overview the sh7052f/sh7053f/sh7054f has an on-chip advanced timer unit-ii (atu-ii) with one 32-bit timer channel and eleven 16-bit timer channels. 10.1.1 features atu-ii features are summarized below. ? capability to process up to 63 pulse inputs and outputs ? prescaler ? input clock to channels 0 and 10 scaled in 1 stage, input clock to channels 1 to 8 and 11 scaled in 2 stages ? 1/1 to 1/32 clock scaling possible in initial stage for all channels ? 1/1, 1/2, 1/4, 1/8, 1/16, or 1/32 scaling possible in second stage for channels 1 to 8 and 11 ? external clock tclka, tclkb selection also possible for channels 1 to 5 and 11 ? channel 0 has four 32-bit input capture lines, allowing the following operations: ? rising-edge, falling-edge, or both-edge detection selectable ? dmac can be activated at capture timing ? channel 10 compare-match signal can be captured as a trigger ? interval interrupt generation function generates three interval interrupts as selected. cpu interruption or a/d converter (ad0, 1) activation possible ? capture interrupt and counter overflow interrupt can be generated ? channel 1 has one 16-bit output compare register, eight general registers, and one dedicated input capture register. the output compare register can also be selected for one-shot pulse offset in combination with the channel 8 down-counter. ? general registers (gr1a to h) can be used as input capture or output compare registers ? waveform output by means of compare-match: selection of 0 output, 1 output, or toggle output ? input capture function: rising-edge, falling-edge, or both-edge detection ? channel 0 input signal (ti0a) can be captured as trigger ? provision for forcible cutoff of channel 8 down-counters (dcnt8a to h) ? compare-match interrupts/capture interrupts and counter overflow interrupts can be generated
174 ? channel 2 has eight 16-bit output compare registers, eight general registers, and one dedicated input capture register. the output compare registers can also be selected for one-shot pulse offset in combination with the channel 8 down-counter. ? general registers (gr2a to h) can be used as input capture or output compare registers ? waveform output by means of compare-match: selection of 0 output, 1 output, or toggle output ? input capture function: rising-edge, falling-edge, or both-edge detection ? channel 0 input signal (ti0a) can be captured as trigger ? provision for forcible cutoff of channel 8 down-counters (dcnt8a to h) ? compare-match interrupts/capture interrupts and counter overflow interrupts can be generated ? channels 3 to 5 each have four general registers, allowing the following operations: ? selection of input capture, output compare, pwm mode ? waveform output by means of compare-match: selection of 0 output, 1 output, or toggle output ? input capture function: rising-edge, falling-edge, or both-edge detection ? channel 9 compare-match signal can be captured as trigger (channel 3 only) ? compare-match interrupts/capture interrupts can be generated ? channels 6 and 7 have four 16-bit duty registers, four cycle registers, and four buffer registers, allowing the following operations: ? any cycle and duty from 0 to 100% can be set ? duty buffer register value transferred to duty register every cycle ? interrupts can be generated every cycle ? complementary pwm output can be set (channel 6 only) ? channel 8 has sixteen 16-bit down-counters for one-shot pulse output, allowing the following operations: ? one-shot pulse generation by down-counter ? down-counter can be rewritten during count ? interrupt can be generated at end of down-count ? offset one-shot pulse function available ? can be linked to channel 1 and 2 output compare functions ? channel 9 has six event counters and six output compare registers, allowing the following operations: ? event counters can be cleared by compare-match ? rising-edge, falling-edge, or both-edge detection available for external input ? compare-match signal can be input to channel 3
175 ? channel 10 has a 32-bit output compare and input capture register, free-running counter, 16-bit free-running counter, output compare/input capture register, reload register, 8-bit event counter, and output compare register, and four 16-bit reload counters, allowing the following operations: ? capture on external input pin edge input ? reload count possible with 32, 64, 128, or 256 times the captured value ? internal clock generated by reload counter underflow can be used as 16-bit free-running counter input ? channel 1 and 2 free-running counter clearing capability ? channel 11 has one 16-bit free-running counter and two 16-bit general registers, allowing the following operations: ? two general registers can be used for compare-match ? compare-match signal can be output to apc ? high-speed access to internal 16-bit bus ? high-speed access to 16-bit bus for 16-bit registers: timer counters, compare registers, and capture registers ? 75 interrupt sources ? four input capture interrupt requests, one overflow interrupt request, and one interval interrupt request for channel 0 ? sixteen dual input capture/compare-match interrupt requests and two counter overflow interrupt requests for channels 1 and 2 ? twelve dual input capture/compare-match interrupt requests and three overflow interrupt requests for channels 3 to 5 ? eight compare-match interrupts for channels 6 and 7 ? sixteen one-shot end interrupt requests for channel 8 ? six compare-match interrupts for channel 9 ? two compare-match interrupts and one dual-function input capture/compare-match interrupt for channel 10 ? two dual input capture/compare-match interrupt requests and one overflow interrupt request for channel 11 ? direct memory access controller (dmac) activation ? the dmac can be activated by a channel 0 input capture interrupt (ici0a to d) ? the dmac can be activated by a channel 6 cycle register 6 compare-match interrupt (cmi6a to d) ? the dmac can be activated by a channel 7 cycle register 7 compare-match interrupt (cmi7a to d) ? a/d converter activation ? the a/d converter can be activated by detection of 1 in bits itva6 to 13 of the channel 0 interval interrupt request registers (itvrr1, itvrr2a, itvrr2b)
176 table 10.1 lists the functions of the atu-ii. table 10.1 atu-ii functions item channel 0 channel 1 channel 2 channels 3 to 5 counter configu- ration clock sources * ( * same vector) 15 sources dual input capture/ compare-match
177 table 10.1 atu-ii functions (cont) item channels 6, 7 channel 8 channel 9 channel 10 channel 11 counter configu- ration clock sources ( ? (
178 10.1.2 pin configuration table 10.2 shows the pin configuration of the atu-ii. when these external pin functions are used, the pin function controller (pfc) should also be set in accordance with the atu-ii settings. if there are a number of pins with the same function, make settings so that only one of the pins is used. for details, see section 18, pin function controller. table 10.2 atu-ii pins channel name abbreviation i/o function common clock input a tclka input external clock a input pin clock input b tclkb input external clock b input pin 0 input capture 0a ti0a input icr0ah, icr0al input capture input pin input capture 0b ti0b input icr0bh, icr0bl input capture input pin input capture 0c ti0c input icr0ch, icr0cl input capture input pin input capture 0d ti0d input icr0dh, icr0dl input capture input pin 1 input capture/output compare 1a tio1a input/ output gr1a output compare output/input capture input input capture/output compare 1b tio1b input/ output gr1b output compare output/input capture input input capture/output compare 1c tio1c input/ output gr1c output compare output/input capture input input capture/output compare 1d tio1d input/ output gr1d output compare output/input capture input input capture/output compare 1e tio1e input/ output gr1e output compare output/input capture input input capture/output compare 1f tio1f input/ output gr1f output compare output/input capture input input capture/output compare 1g tio1g input/ output gr1g output compare output/input capture input input capture/output compare 1h tio1h input/ output gr1h output compare output/input capture input
179 table 10.2 atu-ii pins (cont) channel name abbreviation i/o function 2 input capture/output compare 2a tio2a input/ output gr2a output compare output/input capture input input capture/output compare 2b tio2b input/ output gr2b output compare output/input capture input input capture/output compare 2c tio2c input/ output gr2c output compare output/input capture input input capture/output compare 2d tio2d input/ output gr2d output compare output/input capture input input capture/output compare 2e tio2e input/ output gr2e output compare output/input capture input input capture/output compare 2f tio2f input/ output gr2f output compare output/input capture input input capture/output compare 2g tio2g input/ output gr2g output compare output/input capture input input capture/output compare 2h tio2h input/ output gr2h output compare output/input capture input 3 input capture/output compare 3a tio3a input/ output gr3a output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 3b tio3b input/ output gr3b output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 3c tio3c input/ output gr3c output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 3d tio3d input/ output gr3d output compare output/input capture input 4 input capture/output compare 4a tio4a input/ output gr4a output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 4b tio4b input/ output gr4b output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 4c tio4c input/ output gr4c output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 4d tio4d input/ output gr4d output compare output/input capture input
180 table 10.2 atu-ii pins (cont) channel name abbreviation i/o function 5 input capture/output compare 5a tio5a input/ output gr5a output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 5b tio5b input/ output gr5b output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 5c tio5c input/ output gr5c output compare output/input capture input/pwm output pin (pwm mode) input capture/output compare 5d tio5d input/ output gr5d output compare output/input capture input 6 output compare 6a to6a output pwm output pin output compare 6b to6b output pwm output pin output compare 6c to6c output pwm output pin output compare 6d to6d output pwm output pin 7 output compare 7a to7a output pwm output pin output compare 7b to7b output pwm output pin output compare 7c to7c output pwm output pin output compare 7d to7d output pwm output pin 8 one-shot pulse 8a to8a output one-shot pulse output pin one-shot pulse 8b to8b output one-shot pulse output pin one-shot pulse 8c to8c output one-shot pulse output pin one-shot pulse 8d to8d output one-shot pulse output pin one-shot pulse 8e to8e output one-shot pulse output pin one-shot pulse 8f to8f output one-shot pulse output pin one-shot pulse 8g to8g output one-shot pulse output pin one-shot pulse 8h to8h output one-shot pulse output pin one-shot pulse 8i to8i output one-shot pulse output pin one-shot pulse 8j to8j output one-shot pulse output pin one-shot pulse 8k to8k output one-shot pulse output pin one-shot pulse 8l to8l output one-shot pulse output pin one-shot pulse 8m to8m output one-shot pulse output pin one-shot pulse 8n to8n output one-shot pulse output pin
181 table 10.2 atu-ii pins (cont) channel name abbreviation i/o function 8 one-shot pulse 8o to8o output one-shot pulse output pin one-shot pulse 8p to8p output one-shot pulse output pin 9 event input 9a ti9a input gr9a event input event input 9b ti9b input gr9b event input event input 9c ti9c input gr9c event input event input 9d ti9d input gr9d event input event input 9e ti9e input gr9e event input event input 9f ti9f input gr9f event input 10 input capture ti10 input icr10ah, icr10al input capture input
182 10.1.3 register configuration table 10.3 summarizes the atu-ii registers. table 10.3 atu-ii registers channel name abbrevia- tion r/w initial value address access size (bits) common timer start register 1 tstr1 r/w h'00 h'fffff401 8, 16, 32 timer start register 2 tstr2 r/w h'00 h'fffff400 timer start register 3 tstr3 r/w h'00 h'fffff402 prescaler register 1 pscr1 w h'00 h'fffff404 8 prescaler register 2 pscr2 w h'00 h'fffff406 prescaler register 3 pscr3 w h'00 h'fffff408 prescaler register 4 pscr4 w h'00 h'fffff40a 0 free-running counter 0h tcnt0h r/w h'0000 h'fffff430 32 free-running counter 0l tcnt0l r/w h'0000 input capture register 0ah icr0ah r h'0000 h'fffff434 input capture register 0al icr0al r h'0000 input capture register 0bh icr0bh r h'0000 h'fffff438 input capture register 0bl icr0bl r h'0000 input capture register 0ch icr0ch r h'0000 h'fffff43c input capture register 0cl icr0cl r h'0000 input capture register 0dh icr0dh r h'0000 h'fffff420 input capture register 0dl icr0dl r h'0000 timer interval interrupt request register 1 itvrr1 r/w h'00 h'fffff424 8 timer interval interrupt request register 2a itvrr2a r/w h'00 h'fffff426
183 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 0 timer interval interrupt request register 2b itvrr2b r/w h'00 h'fffff428 8 timer i/o control register tior0 r/w h'00 h'fffff42a timer status register 0 tsr0 r/(w) * h'0000 h'fffff42c 16 timer interrupt enable register 0 tier0 r/w h'0000 h'fffff42e 1 free-running counter 1a tcnt1a r/w h'0000 h'fffff440 16 free-running counter 1b tcnt1b r/w h'0000 h'fffff442 general register 1a gr1a r/w h'ffff h'fffff444 general register 1b gr1b r/w h'ffff h'fffff446 general register 1c gr1c r/w h'ffff h'fffff448 general register 1d gr1d r/w h'ffff h'fffff44a general register 1e gr1e r/w h'ffff h'fffff44c general register 1f gr1f r/w h'ffff h'fffff44e general register 1g gr1g r/w h'ffff h'fffff450 general register 1h gr1h r/w h'ffff h'fffff452 output compare register 1 ocr1 r/w h'ffff h'fffff454 offset base register 1 osbr1 r h'0000 h'fffff456 timer i/o control register 1a tior1a r/w h'00 h'fffff459 8, 16 timer i/o control register 1b tior1b r/w h'00 h'fffff458 timer i/o control register 1c tior1c r/w h'00 h'fffff45b timer i/o control register 1d tior1d r/w h'00 h'fffff45a timer control register 1a tcr1a r/w h'00 h'fffff45d timer control register 1b tcr1b r/w h'00 h'fffff45c
184 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 1 timer status register 1a tsr1a r/(w) * h'0000 h'fffff45e 16 timer status register 1b tsr1b r/(w) * h'0000 h'fffff460 timer interrupt enable register 1a tier1a r/w h'0000 h'fffff462 timer interrupt enable register 1b tier1b r/w h'0000 h'fffff464 trigger mode register trgmdr r/w h'00 h'fffff466 8 2 free-running counter 2a tcnt2a r/w h'0000 h'fffff600 16 free-running counter 2b tcnt2b r/w h'0000 h'fffff602 general register 2a gr2a r/w h'ffff h'fffff604 general register 2b gr2b r/w h'ffff h'fffff606 general register 2c gr2c r/w h'ffff h'fffff608 general register 2d gr2d r/w h'ffff h'fffff60a general register 2e gr2e r/w h'ffff h'fffff60c general register 2f gr2f r/w h'ffff h'fffff60e general register 2g gr2g r/w h'ffff h'fffff610 general register 2h gr2h r/w h'ffff h'fffff612 output compare register 2a ocr2a r/w h'ffff h'fffff614 output compare register 2b ocr2b r/w h'ffff h'fffff616 output compare register 2c ocr2c r/w h'ffff h'fffff618 output compare register 2d ocr2d r/w h'ffff h'fffff61a output compare register 2e ocr2e r/w h'ffff h'fffff61c output compare register 2f ocr2f r/w h'ffff h'fffff61e
185 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 2 output compare register 2g ocr2g r/w h'ffff h'fffff620 16 output compare register 2h ocr2h r/w h'ffff h'fffff622 offset base register 2 osbr2 r h'0000 h'fffff624 timer i/o control register 2a tior2a r/w h'00 h'fffff627 8, 16 timer i/o control register 2b tior2b r/w h'00 h'fffff626 timer i/o control register 2c tior2c r/w h'00 h'fffff629 timer i/o control register 2d tior2d r/w h'00 h'fffff628 timer control register 2a tcr2a r/w h'00 h'fffff62b timer control register 2b tcr2b r/w h'00 h'fffff62a timer status register 2a tsr2a r/(w) * h'0000 h'fffff62c 16 timer status register 2b tsr2b r/(w) * h'0000 h'fffff62e timer interrupt enable register 2a tier2a r/w h'0000 h'fffff630 timer interrupt enable register 2b tier2b r/w h'0000 h'fffff632 3 to 5 timer status register 3 tsr3 r/(w) * h'0000 h'fffff480 16 timer interrupt enable register 3 tier3 r/w h'0000 h'fffff482 timer mode register tmdr r/w h'00 h'fffff484 8 3 free-running counter 3 tcnt3 r/w h'0000 h'fffff4a0 16 general register 3a gr3a r/w h'ffff h'fffff4a2 general register 3b gr3b r/w h'ffff h'fffff4a4 general register 3c gr3c r/w h'ffff h'fffff4a6 general register 3d gr3d r/w h'ffff h'fffff4a8
186 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 3 timer i/o control register 3a tior3a r/w h'00 h'fffff4ab 8, 16 timer i/o control register 3b tior3b r/w h'00 h'fffff4aa timer control register 3 tcr3 r/w h'00 h'fffff4ac 8 4 free-running counter 4 tcnt4 r/w h'0000 h'fffff4c0 16 general register 4a gr4a r/w h'ffff h'fffff4c2 general register 4b gr4b r/w h'ffff h'fffff4c4 general register 4c gr4c r/w h'ffff h'fffff4c6 general register 4d gr4d r/w h'ffff h'fffff4c8 timer i/o control register 4a tior4a r/w h'00 h'fffff4cb 8, 16 timer i/o control register 4b tior4b r/w h'00 h'fffff4ca timer control register 4 tcr4 r/w h'00 h'fffff4cc 8 5 free-running counter 5 tcnt5 r/w h'0000 h'fffff4e0 16 general register 5a gr5a r/w h'ffff h'fffff4e2 general register 5b gr5b r/w h'ffff h'fffff4e4 general register 5c gr5c r/w h'ffff h'fffff4e6 general register 5d gr5d r/w h'ffff h'fffff4e8 timer i/o control register 5a tior5a r/w h'00 h'fffff4eb 8, 16 timer i/o control register 5b tior5b r/w h'00 h'fffff4ea timer control register 5 tcr5 r/w h'00 h'fffff4ec 8 6 free-running counter 6a tcnt6a r/w h'0001 h'fffff500 16 free-running counter 6b tcnt6b r/w h'0001 h'fffff502 free-running counter 6c tcnt6c r/w h'0001 h'fffff504 free-running counter 6d tcnt6d r/w h'0001 h'fffff506
187 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 6 cycle register 6a cylr6a r/w h'ffff h'fffff508 16 cycle register 6b cylr6b r/w h'ffff h'fffff50a cycle register 6c cylr6c r/w h'ffff h'fffff50c cycle register 6d cylr6d r/w h'ffff h'fffff50e buffer register 6a bfr6a r/w h'ffff h'fffff510 buffer register 6b bfr6b r/w h'ffff h'fffff512 buffer register 6c bfr6c r/w h'ffff h'fffff514 buffer register 6d bfr6d r/w h'ffff h'fffff516 duty register 6a dtr6a r/w h'ffff h'fffff518 duty register 6b dtr6b r/w h'ffff h'fffff51a duty register 6c dtr6c r/w h'ffff h'fffff51c duty register 6d dtr6d r/w h'ffff h'fffff51e timer control register 6a tcr6a r/w h'00 h'fffff521 8, 16 timer control register 6b tcr6b r/w h'00 h'fffff520 timer status register 6 tsr6 r/(w) * h'0000 h'fffff522 16 timer interrupt enable register 6 tier6 r/w h'0000 h'fffff524 pwm mode register pmdr r/w h'00 h'fffff526 8 7 free-running counter 7a tcnt7a r/w h'0001 h'fffff580 16 free-running counter 7b tcnt7b r/w h'0001 h'fffff582 free-running counter 7c tcnt7c r/w h'0001 h'fffff584 free-running counter 7d tcnt7d r/w h'0001 h'fffff586 cycle register 7a cylr7a r/w h'ffff h'fffff588 cycle register 7b cylr7b r/w h'ffff h'fffff58a cycle register 7c cylr7c r/w h'ffff h'fffff58c cycle register 7d cylr7d r/w h'ffff h'fffff58e
188 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 7 buffer register 7a bfr7a r/w h'ffff h'fffff590 16 buffer register 7b bfr7b r/w h'ffff h'fffff592 buffer register 7c bfr7c r/w h'ffff h'fffff594 buffer register 7d bfr7d r/w h'ffff h'fffff596 duty register 7a dtr7a r/w h'ffff h'fffff598 duty register 7b dtr7b r/w h'ffff h'fffff59a duty register 7c dtr7c r/w h'ffff h'fffff59c duty register 7d dtr7d r/w h'ffff h'fffff59e timer control register 7a tcr7a r/w h'00 h'fffff5a1 8, 16 timer control register 7b tcr7b r/w h'00 h'fffff5a0 timer status register 7 tsr7 r/(w) * h'0000 h'fffff5a2 16 timer interrupt enable register 7 tier7 r/w h'0000 h'fffff5a4 8 down-counter 8a dcnt8a r/w h'0000 h'fffff640 16 down-counter 8b dcnt8b r/w h'0000 h'fffff642 down-counter 8c dcnt8c r/w h'0000 h'fffff644 down-counter 8d dcnt8d r/w h'0000 h'fffff646 down-counter 8e dcnt8e r/w h'0000 h'fffff648 down-counter 8f dcnt8f r/w h'0000 h'fffff64a down-counter 8g dcnt8g r/w h'0000 h'fffff64c down-counter 8h dcnt8h r/w h'0000 h'fffff64e down-counter 8i dcnt8i r/w h'0000 h'fffff650 down-counter 8j dcnt8j r/w h'0000 h'fffff652 down-counter 8k dcnt8k r/w h'0000 h'fffff654 down-counter 8l dcnt8l r/w h'0000 h'fffff656 down-counter 8m dcnt8m r/w h'0000 h'fffff658 down-counter 8n dcnt8n r/w h'0000 h'fffff65a down-counter 8o dcnt8o r/w h'0000 h'fffff65c down-counter 8p dcnt8p r/w h'0000 h'fffff65e
189 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 8 reload register 8 rldr8 r/w h'0000 h'fffff660 16 timer connection register tcnr r/w h'0000 h'fffff662 one-shot pulse terminate register otr r/w h'0000 h'fffff664 down-count start register dstr r/w h'0000 h'fffff666 timer control register 8 tcr8 r/w h'00 h'fffff668 8 timer status register 8 tsr8 r/(w) * h'0000 h'fffff66a 16 timer interrupt enable register 8 tier8 r/w h'0000 h'fffff66c reload enable register rldenr r/w h'00 h'fffff66e 8 9 event counter 9a ecnt9a r/w h'00 h'fffff680 8 event counter 9b ecnt9b r/w h'00 h'fffff682 event counter 9c ecnt9c r/w h'00 h'fffff684 event counter 9d ecnt9d r/w h'00 h'fffff686 event counter 9e ecnt9e r/w h'00 h'fffff688 event counter 9f ecnt9f r/w h'00 h'fffff68a general register 9a gr9a r/w h'ff h'fffff68c general register 9b gr9b r/w h'ff h'fffff68e general register 9c gr9c r/w h'ff h'fffff690 general register 9d gr9d r/w h'ff h'fffff692 general register 9e gr9e r/w h'ff h'fffff694 general register 9f gr9f r/w h'ff h'fffff696 timer control register 9a tcr9a r/w h'00 h'fffff698 timer control register 9b tcr9b r/w h'00 h'fffff69a timer control register 9c tcr9c r/w h'00 h'fffff69c timer status register 9 tsr9 r/(w) * h'0000 h'fffff69e 16 timer interrupt enable register 9 tier9 r/w h'0000 h'fffff6a0
190 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 10 free-running counter 10ah tcnt10ah r/w h'0000 h'fffff6c0 32 free-running counter 10al tcnt10al r/w h'0001 event counter 10b tcnt10b r/w h'00 h'fffff6c4 8 reload counter 10c tcnt10c r/w h'0001 h'fffff6c6 16 correction counter 10d tcnt10d r/w h'00 h'fffff6c8 8 correction angle counter 10e tcnt10e r/w h'0000 h'fffff6ca 16 correction angle counter 10f tcnt10f r/w h'0001 h'fffff6cc free-running counter 10g tcnt10g r/w h'0000 h'fffff6ce input capture register 10ah icr10ah r h'0000 h'fffff6d0 32 input capture register 10al icr10al r h'0000 output compare register 10ah ocr10ah r/w h'ffff h'fffff6d4 output compare register 10al ocr10al r/w h'ffff output compare register 10b ocr10b r/w h'ff h'fffff6d8 8 reload register 10c rld10c r/w h'0000 h'fffff6da 16 general register 10g gr10g r/w h'ffff h'fffff6dc noise canceler counter 10h tcnt10h r/w h'00 h'fffff6de 8 noise canceler register 10 ncr10 r/w h'ff h'fffff6e0 timer i/o control register 10 tior10 r/w h'00 h'fffff6e2 timer control register 10 tcr10 r/w h'00 h'fffff6e4
191 table 10.3 atu-ii registers (cont) channel name abbrevia- tion r/w initial value address access size (bits) 10 correction counter clear register 10 tcclr10 r/w h'0000 h'fffff6e6 16 timer status register 10 tsr10 r/(w) * h'ffff h'fffff6e8 timer interrupt enable register 10 tier10 r/w h'ffff h'fffff6ea 11 free-running counter 11 tcnt11 r/w h'0000 h'fffff5c0 16 general register 11a gr11a r/w h'ffff h'fffff5c2 general register 11b gr11b r/w h'ffff h'fffff5c4 timer i/o control register 11 tior11 r/w h'00 h'fffff5c6 8 timer control register 11 tcr11 r/w h'00 h'fffff5c8 timer status register 11 tsr11 r/(w) * h'0000 h'fffff5ca 16 timer interrupt enable register 11 tier11 r/w h'0000 h'fffff5cc note: * 0 write after a read
192 10.1.4 block diagrams overall block diagram of atu-ii: figure 10.1 shows an overall block diagram of the atu-ii. ic/oc control i/o interrupt control counter and register control, and comparator tclka tclkb interrupts inter-module connection signals external pins inter-module address bus prescaler clock selection module data bus inter-module data bus 32-bit timer channel 0 16-bit timer channel 1 channel 10 16-bit timer channel 11 tstr1 tstr2 tstr3 bus interface legend: tstr1, 2, 3: timer start registers (8 bits) interrupts: itv0 to itv2, ovi0, ovi1a, ovi1b, ovi2a, ovi2b, ovi3 to ovi5, ovi11, ici0a to ici0d, imi1a to imi1h, cmi1, imi2a to imi2h, cmi2a to cmi2h, imi3a to imi3d, imi4a to imi4d, imi5a to imi5d, cmi6a to cmi6d, cmi7a to cmi7d, osi8a to osi8p, cmi9a to cmi9f, cmi10a, cmi10b, ici10a, cmi10g, imi11a, imi11b external pins: ti0a to ti0d, tio1a to tio1h, tio2a to tio2h, tio3a to tio3d, tio4a to tio4d, tio5a to tio5d, to6a to to6d, to7a to to7d, to8a to to8p, ti9a to ti9f, ti10 inter-module connection signals: signals to a/d converter, signals to direct memory access controller (dmac), signals to advanced pulse controller (apc) . . . . . . . . p ? figure 10.1 overall block diagram of atu-ii
193 block diagram of channel 0: figure 10.2 shows a block diagram of atu-ii channel 0. a/d converter trigger trgod (ocr10b compare-match signal) control logic i/o control osbr (ch1, ch2) internal data bus and address bus str0 ti0a ti0b ti0c ti0d prescaler 1 overflow interrupt signal interval interrupt tior0 tier0 itvrr1 itvrr2a itvrr2b tsr0 icr0al icr0bl icr0cl icr0dl tcnt0l icr0ah icr0bh icr0ch icr0dh tcnt0h figure 10.2 block diagram of channel 0
194 block diagram of channel 1: figure 10.3 shows a block diagram of atu-ii channel 1. control logic i/o control internal data bus and address bus tio1a tio1b tio1c tio1d tio1e tio1f tio1g tio1h str1a/2b prescaler 1 tclka tclkb ti10 (agck) ti10 multiplication (agckm) one-shot start trigger (ch8) trg1a (counter clear trigger from ch10) trg1b (counter clear trigger from ch10) one-shot terminate trigger (ch8) overflow interrupt 1 input capture/output compare interrupts 8 gr1a gr1b gr1c gr1d gr1e gr1f gr1g gr1h osbr1 tcnt1a clock selection logic (2 systems: a, b) ti0a(capture signal from ch0) compa- rator ocr1 tcnt1b tior1a tior1b tior1c tior1d tcr1a tcr1b tsr1a tsr1b tier1a tier1b trgmdr figure 10.3 block diagram of channel 1
195 block diagram of channel 2: figure 10.4 shows a block diagram of atu-ii channel 2. control logic i/o control internal data bus and address bus tio2a tio2b tio2c tio2d tio2e tio2f tio2g tio2h str2a/2b prescaler 1 tclka tclkb ti10 (agckm) ti10 multiplication (agck) one-shot start trigger (ch8) trg2a (counter clear trigger from ch10) trg2b (counter clear trigger from ch10) one-shot terminate trigger (ch8) overflow interrupt 1 input capture/output compare interrupts 8 gr2a gr2b gr2c gr2d gr2e gr2f gr2g gr2h osbr2 tcnt2a ocr2a ocr2b ocr2c ocr2d ocr2e ocr2f ocr2g ocr2h tcnt2b clock selection logic ti0a (couter clear trigger from ch0) compa- rator tior2a tior2b tior2c tior2d tcr2a tcr2b tsr2a tsr2b tier2a tier2b figure 10.4 block diagram of channel 2
196 block diagram of channels 3 to 5: figure 10.5 shows a block diagram of atu-ii channels 3, 4, and 5. control logic i/o control internal data bus and address bus tio3a tio3b tio3c tio3d tio4a tio4b tio4c tio4d tio5a tio5b tio5c tio5d str3 to 5 prescaler 1 tclka tclkb ti10 (agck) ti10 multiplication (agckm) channel 9 compare- match trigger overflow interrupts 3 input capture/output compare interrupts 12 gr3d tcnt3 tior3a tior3b tcr3 gr5d tcnt5 tior5a tior5b tcr5 tmdr tier3 tsr3 gr3a clock selection logic (3 systems: ch3, 4, 5) compa- rator gr4a gr4d tcnt4 tior4a tior4b tcr4 gr5a figure 10.5 block diagram of channels 3 to 5
197 block diagram of channels 6 and 7: figure 10.6 shows a block diagram of atu-ii channels 6 and 7. control logic i/o control internal data bus and address bus note: channel 7 has no pmdr7. to6a to6b to6c to6d tsr6 , 7 prescaler 2 compare-match interrupts 4 clock selection logic (a e d independent) compa- rator bfr6a cylr6a dtr6a tcnt6a bfr6b cylr6b dtr6b tcnt6b bfr6c cylr6c dtr6c tcnt6c bfr6d cylr6d dtr6d tcnt6d tcr6a tcr6b tsr6 tier6 pmdr figure 10.6 block diagram of channel 6 (same configuration for channel 7)
198 block diagram of channel 8: figure 10.7 shows a block diagram of atu-ii channel 8. control logic i/o control internal data bus and address bus to8a to8b to8o to8p prescaler 1 down-count end interrupts 16 (osi) compa- rator one-shot start trigger (ch1, 2) one-shot terminate trigger (ch1, 2) rldr8 tcnr otr dstr tcr8 tsr8 tier8 rldenr dcnt8m dcnt8n dcnt8o dcnt8p dcnt8a dcnt8b dcnt8c dcnt8d clock selection (2 systems: a e h, i e p) figure 10.7 block diagram of channel 8
199 block diagram of channel 9: figure 10.8 shows a block diagram of atu-ii channel 9. control logic i/o control internal data bus and address bus ti9a ti9b ti9c ti9d ti9e ti9f channel 3 capture trigger 4 compare-match interrupts 6 gr9a ecnt9a gr9b ecnt9b gr9c ecnt9c gr9d ecnt9d gr9e ecnt9e gr9f ecnt9f tcr9a tcr9b tcr9c tsr9 tier9 compa- rator figure 10.8 block diagram of channel 9
200 block diagram of channel 10: figure 10.9 shows a block diagram of atu-ii channel 10. control logic i/o control internal data bus and address bus ti10 output compare interrupts 2 input capture / output compare interrupt 1 trg0d (ocr10b compare- match signal) trg1a, 1b, 2a, 2b (counter clear trigger) frequency multipli- cation clock frequency multipli- cation correction clock ocr10b tcnt10b rld10c tcnt10c tcnt10d tcnt10e tcnt10f gr10g tcnt10g ncr10 tcnt10h tcclr10 tior10 tcr10 tier10 tsr10 str10 icr10al ocr10al tcnt10al icr10ah ocr10ah tcnt10ah prescaler 4 figure 10.9 block diagram of channel 10
201 block diagram of channel 11: figure 10.10 shows a block diagram of atu-ii channel 11. control logic internal data bus and address bus str11 prescaler 4 overflow interrupt 1 output compare interrupts 2 apc output compare-match timing signals 2 tclka tclkb clock selection logic compa- rator gr11a gr11b tcnt11 tior11 tcr11 tsr11 tier11 figure 10.10 block diagram of channel 11
202 10.1.5 inter-channel and inter-module signal communication diagram figure 10.11 shows the connections between channels and between modules in the atu-ii. dcnt8a dcnt8b dcnt8c dcnt8d dcnt8e dcnt8f dcnt8g dcnt8h icr0a icr0b icr0c icr0d tcnt1a tcnt1b gr1a gr1b gr1h itvrr1 itvrr2a itvrr2b a/d converter activation dmac activation capture trigger ti10(agck) ti10 multiplication (agckm) ti10(agck) ti10 multiplication (agckm) ti10(agck) ti10 multiplication (agckm) ti10(agck) ti10 multiplication (agckm) ti10(akck) ti10 multiplication (agckm) dmac activation (compare-match) compare-match signal transmission to advanced pulse controller (apc) one-shot start one-shot terminate osbr1 ocr10b tcnt10f ocr1 tcnt2a tcnt2b gr2a gr2b gr2h ocr2a ocr2b ocr2h osbr2 channel 2 channel 8 channel 1 channel 0 channel 10 gr9a gr9b gr9c gr9d gr9e gr9f channel 9 cylr6x, 7x dtr6x, 7x bfr6x, 7x tcnt6x, 7x x: a, b, c, d channel 6, 7 gr11a gr11b tcnt11 channel 11 gr3a gr3b gr3c gr3d channel 3 channel 4 channel 5 dcnt8i dcnt8j dcnt8k dcnt8l dcnt8m dcnt8n dcnt8o dcnt8p ti0a counter clear trigger capture trigger capture trigger figure 10.11 inter-module communication signals
203 10.1.6 prescaler diagram figure 10.12 shows a diagram of the atu-ii prescalers. prescaler 1 channel 1 channel 0 channel 2 channel 3 channel 4 channel 5 channel 8 prescaler 2 channel 6 channel 7 channel 11 channel 9 channel 10 timer control register prescaler 3 prescaler 4 input clock /2 tclka tclkb ti10 ti9a ti9b ti9c ti9d ti9e ti9f edge detection figure 10.12 prescaler diagram
204 10.2 register descriptions 10.2.1 timer start registers (tstr) the timer start registers (tstr) are 8-bit registers. the atu-ii has three tstr registers. channel abbreviation function 0, 1, 2, 3, 4, 5, 10 tstr1 free-running counter operation/stop setting 6, 7 tstr2 11 tstr3 timer start register 1 (tstr1) bit: 7 6 5 4 3 2 1 0 str10 str5 str4 str3 str1b, 2b str2a str1a str0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w tstr1 is an 8-bit readable/writable register that starts and stops the free-running counter (tcnt) in channels 0 to 5 and 10. tstr1 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bit 7?ounter start 10 (str10): starts and stops channel 10 counters (tcnt10a, 10c, 10d, 10e, 10f, and 10g). tcnt10b and 10h are not stopped. bit 7: str10 description 0 tcnt10 is halted (initial value) 1 tcnt10 counts ? bit 6?ounter start 5 (str5): starts and stops free-running counter 5 (tcnt5). bit 6: str5 description 0 tcnt5 is halted (initial value) 1 tcnt5 counts
205 ? bit 5?ounter start 4 (str4): starts and stops free-running counter 4 (tcnt4). bit 5: str4 description 0 tcnt4 is halted (initial value) 1 tcnt4 counts ? bit 4?ounter start 3 (str3): starts and stops free-running counter 3 (tcnt3). bit 4: str3 description 0 tcnt3 is halted (initial value) 1 tcnt3 counts ? bit 3?ounter start 1b, 2b (str1b, str2b): starts and stops free-running counters 1b and 2b (tcnt1b, tcnt2b). bit 3: str1b, str2b description 0 tcnt1b and tcnt2b are halted (initial value) 1 tcnt1b and tcnt2b count ? bit 2?ounter start 2a (str2a): starts and stops free-running counter 2a (tcnt2a). bit 2: str2a description 0 tcnt2a is halted (initial value) 1 tcnt2a counts ? bit 1?ounter start 1a (str1a): starts and stops free-running counter 1a (tcnt1a). bit 1: str1a description 0 tcnt1a is halted (initial value) 1 tcnt1a counts ? bit 0?ounter start 0 (str0): starts and stops free-running counter 0 (tcnt0). bit 0: str0 description 0 tcnt0 is halted (initial value) 1 tcnt0 counts
206 timer start register 2 (tstr2) bit: 7 6 5 4 3 2 1 0 str7d str7c str7b str7a str6d str6c str6b str6a initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w tstr2 is an 8-bit readable/writable register that starts and stops the free-running counter (tcnt) in channels 6 and 7. tstr2 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bit 7?ounter start 7d (str7d): starts and stops free-running counter 7d (tcnt7d). bit 7: str7d description 0 tcnt7d is halted (initial value) 1 tcnt7d counts ? bit 6?ounter start 7c (str7c): starts and stops free-running counter 7c (tcnt7c). bit 6: str7c description 0 tcnt7c is halted (initial value) 1 tcnt7c counts ? bit 5?ounter start 7b (str7b): starts and stops free-running counter 7b (tcnt7b). bit 5: str7b description 0 tcnt7b is halted (initial value) 1 tcnt7b counts ? bit 4?ounter start 7a (str7a): starts and stops free-running counter 7a (tcnt7a). bit 4: str7a description 0 tcnt7a is halted (initial value) 1 tcnt7a counts
207 ? bit 3?ounter start 6d (str6d): starts and stops free-running counter 6d (tcnt6d). bit 3: str6d description 0 tcnt6d is halted (initial value) 1 tcnt6d counts ? bit 2?ounter start 6c (str6c): starts and stops free-running counter 6c (tcnt6c). bit 2: str6c description 0 tcnt6c is halted (initial value) 1 tcnt6c counts ? bit 1?ounter start 6b (str6b): starts and stops free-running counter 6b (tcnt6b). bit 1: str6b description 0 tcnt6b is halted (initial value) 1 tcnt6b counts ? bit 0?ounter start 6a (str6a): starts and stops free-running counter 6a (tcnt6a). bit 0: str6a description 0 tcnt6a is halted (initial value) 1 tcnt6a counts timer start register 3 (tstr3) bit: 7 6 5 4 3 2 1 0 ??????? str11 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w tstr3 is an 8-bit readable/writable register that starts and stops the free-running counter (tcnt11) in channel 11. tstr3 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bits 7 to 1?eserved: these bits always read 0. the write value should always be 0.
208 ? bit 0?ounter start 11 (str11): starts and stops free-running counter 11 (tcnt11). bit 0: str11 description 0 tcnt11 is halted (initial value) 1 tcnt11 counts 10.2.2 prescaler registers (pscr) the prescaler registers (pscr) are 8-bit registers. the atu-ii has four pscr registers. channel abbreviation function 0, 1, 2, 3, 4, 5, 8, 11 pscr1 prescaler setting for respective channels 6 pscr2 7 pscr3 10 pscr4 pscrx is an 8-bit writable register that enables the first-stage counter clock ' input to each channel to be set to any value from p /1 to p /32. bit: 7 6 5 4 3 2 1 0 ??? pscxe pscxd pscxc pscxb pscxa initial value: ??? 00000 r/w: ??? wwwww x = 1 to 4 input counter clock ' is determined by setting pscxa to pscxe: ' is p /1 when the set value is h'00, and p /32 when h'1f. pscrx is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. the internal clock ' set with this register can undergo further second-stage scaling to create clock " for channels 1 to 8 and 11, the setting being made in the timer control register (tcr). ? bits 7 to 5?eserved. these bits cannot be modified. ? bits 4 to 0?rescaler (pscxe, pscxd, pscxc, pscxb, pscxa): these bits specify frequency division of first-stage counter clock ' input to the corresponding channel.
209 10.2.3 timer control registers (tcr) the timer control registers (tcr) are 8-bit registers. the atu-ii has 16 tcr registers: two each for channels 1 and 2, one each for channels 3, 4, 5, 8, and 11, two each for channels 6 and 7, and three for channel 9. for details of channel 10, see section 10.2.26, channel 10 registers. channel abbreviation function 1 tcr1a, tcr1b internal clock/external clock/ti10 input clock selection 2 tcr2a, tcr2b 3 tcr3 4 tcr4 5 tcr5 6 tcr6a, tcr6b internal clock selection 7 tcr7a, tcr7b 8 tcr8 9 tcr9a, tcr9b, tcr9c external clock selection/setting of channel 3 trigger in event of compare-match 11 tcr11 internal clock/external clock selection each tcr is an 8-bit readable/writable register that selects whether an internal clock or external clock is used for channels 1 to 5 and 11. for channels 6 to 8, tcr selects an internal clock, and for channel 9, an external clock. when an internal clock is selected, tcr selects the value of " further scaled from clock ' scaled with prescaler register 1 (pscr1). scaled clock " can be selected, for channels 1 to 8 and 11 only, from ', '/2, '/4, '/8, '/16, and '/32 (only ' is available for channel 0). edge detection is performed on the rising edge. when an external clock is selected, tcr selects whether tclka, tclkb (channels 1 to 5 and 11 only), ti10 pin input (channels 1 to 5 only), or a ti10 pin input multiplied clock (channels 1 to 5 only) is used, and also performs edge selection. each tcr is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode.
210 timer control registers 1a, 1b, 2a, 2b (tcr1a, tcr1b, tcr2a, tcr2b) tcr1a, tcr2a bit: 76543210 ?? ckega1 ckega0 cksela3 cksela2 cksela1 cksela0 initial value: 00000000 r/w: r r r/w r/w r/w r/w r/w r/w tcr1b, tcr2b bit: 76543210 ?? ckegb1 ckegb0 ckselb3 ckselb2 ckselb1 ckselb0 initial value: 00000000 r/w: r r r/w r/w r/w r/w r/w r/w ? bits 7 and 6?eserved: these bits always read 0. the write value should always be 0. ? bits 5 and 4?lock edge 1 and 0 (ckegx1, ckegx0): these bits select the count edge(s) for external clock tclka and tclkb input. bit 5: ckegx1 bit 4: ckegx0 description 0 0 rising edges counted (initial value) 1 falling edges counted 1 0 both rising and falling edges counted 1 count disabled x = a or b ? bits 3 to 0?lock select a3 to a0, b3 to b0 (cksela3 to cksela0, ckselb3 to ckselb0): these bits select whether an internal clock or external clock is used. when an internal clock is selected, scaled clock " is selected from ', '/2, '/4, '/8, '/16, and '/32. when an external clock is selected, tclka, tclkb, ti10 pin input, or a ti10 pin input multiplied clock is selected. when ti10 pin input and ti10 pin input clock multiplication are selected, set ckeg1 and ckeg0 in tcr10 so that ti10 input is possible.
211 bit 3: ckselx3 bit 2: ckselx2 bit 1: ckselx1 bit 0: ckselx0 description 0000 internal clock ": counting on ' (initial value) 1 internal clock ": counting on '/2 1 0 internal clock ": counting on '/4 1 internal clock ": counting on '/8 1 0 0 internal clock ": counting on '/16 1 internal clock ": counting on '/32 1 0 external clock: counting on tclka pin input 1 external clock: counting on tclkb pin input 1000 counting on ti10 pin input (agck) 1 counting on multiplied (corrected)(agckm) ti10 pin input clock 1 * setting prohibited 1 ** setting prohibited x = a or b * : don ? t care timer control registers 3 to 5 (tcr3, tcr4, tcr5) bit: 7 6 5 4 3 2 1 0 ?? ckeg1 ckeg0 cksel3 cksel2 cksel1 cksel0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w ? bits 7 and 6?eserved: these bits always read 0. the write value should always be 0. ? bits 5 and 4?lock edge 1 and 0 (ckeg1, ckeg0): these bits select the count edge(s) for external clock tclka and tclkb input. bit 5: ckeg1 bit 4: ckeg0 description 0 0 rising edges counted (initial value) 1 falling edges counted 1 0 both rising and falling edges counted 1 count disabled
212 ? bits 3 to 0?lock select 3 to 0 (cksel3 to cksel0): these bits select whether an internal clock or external clock is used. when an internal clock is selected, scaled clock " is selected from ', '/2, '/4, '/8, '/16, and '/32. when an external clock is selected, tclka, tclkb, ti10 pin input, or a ti10 pin input multiplied clock is selected. when ti10 pin input and ti10 pin input clock multiplication are selected, set ckeg1 and ckeg0 in tcr10 so that ti10 input is possible. bit 3: cksel3 bit 2: cksel2 bit 1: cksel1 bit 0: cksel0 description 0000 internal clock ": counting on ' (initial value) 1 internal clock ": counting on '/2 1 0 internal clock ": counting on '/4 1 internal clock ": counting on '/8 1 0 0 internal clock ": counting on '/16 1 internal clock ": counting on '/32 1 0 external clock: counting on tclka pin input 1 external clock: counting on tclkb pin input 1000 counting on ti10 pin input (agck) 1 counting on multiplied (corrected)(agckm) ti10 pin input clock 1 * setting prohibited 1 ** setting prohibited * : don ? t care
213 timer control registers 6a, 6b, 7a, 7b (tcr6a, tcr6b, tcr7a, tcr7b) tcr6a, tcr7a bit: 76543210 ? ckselb2 ckselb1 ckselb0 ? cksela2 cksela1 cksela0 initial value: 00000000 r/w: r r/w r/w r/w r r/w r/w r/w tcr6b, tcr7b bit: 76543210 ? ckseld2 ckseld1 ckseld0 ? ckselc2 ckselc1 ckselc0 initial value: 00000000 r/w: r r/w r/w r/w r r/w r/w r/w ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bits 6 to 4?lock select b2 to b0, d2 to d0 (ckselb2 to ckselb0, ckseld2 to ckseld0): these bits select clock ", scaled from the internal clock source, from ', '/2, '/4, '/8, '/16, and '/32. bit 6: ckselx2 bit 5: ckselx1 bit 4: ckselx0 description 0 0 0 internal clock ": counting on ' (initial value) 1 internal clock ": counting on '/2 1 0 internal clock ": counting on '/4 1 internal clock ": counting on '/8 1 0 0 internal clock ": counting on '/16 1 internal clock ": counting on '/32 1 0 setting prohibited 1 setting prohibited x = b or d ? bit 3?eserved: this bit always reads 0. the write value should always be 0.
214 ? bits 2 to 0?lock select a2 to a0, c2 to c0 (cksela2 to cksela0, ckselc2 to ckselc0): these bits select clock ", scaled from the internal clock source, from ', '/2, '/4, '/8, '/16, and '/32. bit 2: ckselx2 bit 1 ckselx1 bit 0 ckselx0 description 0 0 0 internal clock ": counting on ' (initial value) 1 internal clock ": counting on '/2 1 0 internal clock ": counting on '/4 1 internal clock ": counting on '/8 1 0 0 internal clock ": counting on '/16 1 internal clock ": counting on '/32 1 0 setting prohibited 1 setting prohibited x = a or c timer control register 8 (tcr8) bit: 76543210 ? ckselb2 ckselb1 ckselb0 ? cksela2 cksela1 cksela0 initial value: 00000000 r/w: r r/w r/w r/w r r/w r/w r/w the ckselax bits relate to dcnt8a to dcnt8h, and the ckselbx bits relate to dcnt8i to dcnt8p. ? bit 7?eserved: this bit always reads 0. the write value should always be 0.
215 ? bits 6 to 4?lock select b2 to b0 (ckselb2 to ckselb0): these bits, relating to counters dcnt8i to dcnt8p, select clock ", scaled from the internal clock source, from ', '/2, '/4, '/8, '/16, and '/32. bit 6: ckselb2 bit 5: ckselb1 bit 4: ckselb0 description 0 0 0 internal clock ": counting on ' (initial value) 1 internal clock ": counting on '/2 1 0 internal clock ": counting on '/4 1 internal clock ": counting on '/8 1 0 0 internal clock ": counting on '/16 1 internal clock ": counting on '/32 1 0 setting prohibited 1 setting prohibited ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bits 2 to 0?lock select a2 to a0 (cksela2 to cksela0): these bits, relating to counters dcnt8a to dcnt8h, select clock ", scaled from the internal clock source, from ', '/2, '/4, '/8, '/16, and '/32. bit 2: cksela2 bit 1: cksela1 bit 0: cksela0 description 0 0 0 internal clock ": counting on ' (initial value) 1 internal clock ": counting on '/2 1 0 internal clock ": counting on '/4 1 internal clock ": counting on '/8 1 0 0 internal clock ": counting on '/16 1 internal clock ": counting on '/32 1 0 setting prohibited 1 setting prohibited
216 timer control registers 9a, 9b, 9c (tcr9a, tcr9b, tcr9c) tcr9a bit: 7 6 5 43210 ? trg3ben egselb1 egselb0 ? trg3aen egsela1 egsela0 initial value: 0 0 0 00000 r/w: r r/w r/w r/w r r/w r/w r/w tcr9b bit: 7 6 5 43210 ? trg3den egseld1 egseld0 ? trg3cen egselc1 egselc0 initial value: 0 0 0 00000 r/w: r r/w r/w r/w r r/w r/w r/w tcr9c bit: 7 6 5 43210 ?? egself1 egself0 ?? egsele1 egsele0 initial value: 0 0 0 00000 r/w: r r r/w r/w r r r/w r/w ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?rigger channel 3ben, 3den (trg3ben, trg3den): these bits select the channel 9 event counter compare-match signal channel 3 input capture trigger. bit 6: trg3xen description 0 channel 3 input capture trigger in event of channel 9 compare-match (ecnt9x = gr9x) is disabled (initial value) 1 channel 3 input capture trigger in event of channel 9 compare-match (ecnt9x = gr9x) is enabled x = b or d
217 ? bits 5 and 4?dge select b1, b0, d1, d0, f1, f0 (egselb1, egselb0, egseld1, egseld0, egself1, egself0): these bits select the event counter counted edge(s). bit 5: egselx1 bit 4: egselx0 description 0 0 count disabled (initial value) 1 rising edges counted 1 0 falling edges counted 1 both rising and falling edges counted x = b, d, or f ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?rigger channel 3aen, 3cen (trg3aen, trg3cen): these bits select the channel 9 event counter compare-match signal channel 3 input capture trigger. bit 2: trg3xen description 0 channel 3 input capture trigger in event of channel 9 compare-match (ecnt9x = gr9x) is disabled (initial value) 1 channel 3 input capture trigger in event of channel 9 compare-match (ecnt9x = gr9x) is enabled x = a or c ? bits 1 and 0?dge select a1, a0, c1, c0, e1, e0 (egsela1, egsela0, egselc1, egselc0, egsele1, egsele0): these bits select the event counter counted edge(s). bit 1: egselx1 bit 0: egselx0 description 0 0 count disabled (initial value) 1 rising edges counted 1 0 falling edges counted 1 both rising and falling edges counted x = a, c, or e
218 timer control register 11 (tcr11) bit: 76543210 ?? ckeg1 ckeg0 ? cksela2 cksela1 cksela0 initial value: 00000000 r/w: r r r/w r/w r r/w r/w r/w ? bits 7, 6, and 3?eserved: these bits always read 0. the write value should always be 0. ? bits 5 and 4?dge select: these bits select the event counter counted edge(s). bit 5: ckeg1 bit 4: ckeg0 description 0 0 rising edges counted (initial value) 1 falling edges counted 1 0 both rising and falling edges counted 1 count disabled ? bits 2 to 0?lock select a2 to a0 (cksela2 to cksela0): these bits select clock ", scaled from the internal clock source, from ', '/2, '/4, '/8, '/16, and '/32. bit 2: cksela2 bit 1: cksela1 bit 0: cksela0 description 0 0 0 internal clock ": counting on ' (initial value) 1 internal clock ": counting on '/2 1 0 internal clock ": counting on '/4 1 internal clock ": counting on '/8 1 0 0 internal clock ": counting on '/16 1 internal clock ": counting on '/32 1 0 external clock: counting on tclka pin input 1 external clock: counting on tclkb pin input
219 10.2.4 timer i/o control registers (tior) the timer i/o control registers (tior) are 8-bit registers. the atu-ii has 16 tior registers: one for channel 0, four each for channels 1 and 2, two each for channels 3 to 5, and one for channel 11. for details of channel 10, see section 10.2.26, channel 10 registers. channel abbreviation function 0 tior0 icr0 edge detection setting 1 tior1a to 1d gr input capture/compare-match switching, edge detection/ 2 tior2a to 2d output value setting 3 tior3a, tior3b gr input capture/compare-match switching, edge detection/ 4 tior4a, tior4b output value setting, tcnt3 to tcnt5 clear enable/disable 5 tior5a, tior5b setting 11 tior11 gr input capture/compare-match switching, edge detection/output value setting each tior is an 8-bit readable/writable register used to select the functions of dedicated input capture registers and general registers. for dedicated input capture registers (icr), tior performs edge detection setting. for general registers (gr), tior selects use as an input capture register or output compare register, and performs edge detection setting. for channels 3 to 5, tior also selects enabling or disabling of free-running counter (tcnt) clearing in the event of a compare-match. timer i/o control register 0 (tior0) bit: 7 6 5 4 3 2 1 0 io0d1 io0d0 io0c1 io0c0 io0b1 io0b0 io0a1 io0a0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w tior0 specifies edge detection for input capture registers icr0a to icr0d. tior0 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode.
220 ? bits 7 and 6?/o control 0d1 and 0d0 (io0d1, io0d0): these bits select tiod pin input capture signal edge detection. bit 7: io0d1 bit 6: io0d0 description 0 0 input capture disabled (input capture possible in tcnt10b compare-match) (initial value) 1 input capture in icr0d on rising edge 1 0 input capture in icr0d on falling edge 1 input capture in icr0d on both rising and falling edges ? bits 5 and 4?/o control 0c1 and 0c0 (io0c1, io0c0): these bits select tioc pin input capture signal edge detection. bit 5: io0c1 bit 4: io0c0 description 0 0 input capture disabled (initial value) 1 input capture in icr0c on rising edge 1 0 input capture in icr0c on falling edge 1 input capture in icr0c on both rising and falling edges ? bits 3 and 2?/o control 0b1 and 0b0 (io0b1, io0b0): these bits select tiob pin input capture signal edge detection. bit 3: io0b1 bit 2: io0b0 description 0 0 input capture disabled (initial value) 1 input capture in icr0b on rising edge 1 0 input capture in icr0b on falling edge 1 input capture in icr0b on both rising and falling edges ? bits 1 and 0?/o control 0a1 and 0a0 (io0a1, io0a0): these bits select tioa pin input capture signal edge detection. bit 1: io0a1 bit 0: io0a0 description 0 0 input capture disabled (initial value) 1 input capture in icr0a on rising edge 1 0 input capture in icr0a on falling edge 1 input capture in icr0a on both rising and falling edges
221 timer i/o control registers 1a to 1d (tior1a to tior1d) tior1a bit: 7 6 5 4 3 2 1 0 ? io1b2 io1b1 io1b0 ? io1a2 io1a1 io1a0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r/w r/w tior1b bit: 7 6 5 4 3 2 1 0 ? io1d2 io1d1 io1d0 ? io1c2 io1c1 io1c0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r/w r/w tior1c bit: 7 6 5 4 3 2 1 0 ? io1f2 io1f1 io1f0 ? io1e2 io1e1 io1e0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r/w r/w tior1d bit: 7 6 5 4 3 2 1 0 ? io1h2 io1h1 io1h0 ? io1g2 io1g1 io1g0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r/w r/w registers tior1a to tior1d specify whether general registers gr1a to gr1h are used as input capture or compare-match registers, and also perform edge detection and output value setting. each tior is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bit 7?eserved: this bit always reads 0. the write value should always be 0.
222 ? bits 6 to 4?/o control 1b2 to 1b0, 1d2 to 1d0, 1f2 to 1f0, 1h2 to 1h0 (io1b2 to io1b0, io1d2 to io1d0, iof12 to io1f0, io1h2 to io1h0): these bits select the general register (gr) function. bit 6: io1x2 bit 5: io1x1 bit 4: io1x0 description 0 0 0 gr is an output compare register compare-match disabled; pin output undefined (initial value) 1 0 output on gr compare-match 1 0 1 output on gr compare-match 1 toggle output on gr compare-match 1 0 0 gr is an input capture register input capture disabled (gr cannot be written to) 1 input capture in gr on rising edge at tio1x pin (gr cannot be written to) 1 0 input capture in gr on falling edge at tio1x pin (gr cannot be written to) 1 input capture in gr on both rising and falling edges at tio1x pin (gr cannot be written to) x = b, d, f, or h ? bit 3?eserved: this bit always reads 0. the write value should always be 0.
223 ? bits 2 to 0?/o control 1a2 to 1a0, 1c2 to 1c0, 1e2 to 1e0, 1g2 to 1g0 (io1a2 to io1a0, io1c2 to io1c0, io1e2 to io1e0, io1g2 to io1g0): these bits select the general register (gr) function. bit 2: io1x2 bit 1: io1x1 bit 0: io1x0 description 0 0 0 gr is an output compare register compare-match disabled; pin output undefined (initial value) 1 0 output on gr compare-match 1 0 1 output on gr compare-match 1 toggle output on gr compare-match 1 0 0 gr is an input capture register input capture disabled (gr cannot be written to) 1 input capture in gr on rising edge at tio1x pin (gr cannot be written to) 1 0 input capture in gr on falling edge at tio1x pin (gr cannot be written to) 1 input capture in gr on both rising and falling edges at tio1x pin (gr cannot be written to)
224 timer i/o control registers 2a to 2d (tior2a to tior2d) tior2a bit: 7 6 5 4 3 2 1 0 ? io2b2 io2b1 io2b0 ? io2a2 io2a1 io2a0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r/w r/w tior2b bit: 7 6 5 4 3 2 1 0 ? io2d2 io2d1 io2d0 ? io2c2 io2c1 io2c0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r/w r/w tior2c bit: 7 6 5 4 3 2 1 0 ? io2f2 io2f1 io2f0 ? io2e2 io2e1 io2e0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r/w r/w tior2d bit: 7 6 5 4 3 2 1 0 ? io2h2 io2h1 io2h0 ? io2g2 io2g1 io2g0 initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r r/w r/w r/w registers tior2a to tior2d specify whether general registers gr2a to gr2h are used as input capture or compare-match registers, and also perform edge detection and output value setting. each tior is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode.
225 ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bits 6 to 4?/o control 2b2 to 2b0, 2d2 to 2d0, 2f2 to 2f0, 2h2 to 2h0 (io2b2 to io2b0, io2d2 to io2d0, io2f2 to io2f0, io2h2 to io2h0): these bits select the general register (gr) function. bit 6: io2x2 bit 5: io2x1 bit 4: io2x0 description 0 0 0 gr is an output compare register compare-match disabled; pin output undefined (initial value) 1 0 output on gr compare-match 1 0 1 output on gr compare-match 1 toggle output on gr compare-match 1 0 0 gr is an input capture register input capture disabled 1 input capture in gr on rising edge at tio2x pin (gr cannot be written to) 1 0 input capture in gr on falling edge at tio2x pin (gr cannot be written to) 1 input capture in gr on both rising and falling edges at tio2x pin (gr cannot be written to) x = b, d, f, or h ? bit 3?eserved: this bit always reads 0. the write value should always be 0.
226 ? bits 2 to 0?/o control 2a2 to 2a0, 2c2 to 2c0, 2e2 to 2e0, 2g2 to 2g0 (io2a2 to io2a0, io2c2 to io2c0, io2e2 to io2e0, io2g2 to io2g0): these bits select the general register (gr) function. bit 2: io2x2 bit 1: io2x1 bit 0: io2x0 description 0 0 0 gr is an output compare register compare-match disabled; pin output undefined (initial value) 1 0 output on gr compare-match 1 0 1 output on gr compare-match 1 toggle output on gr compare-match 1 0 0 gr is an input capture register input capture disabled 1 input capture in gr on rising edge at tio2x pin (gr cannot be written to) 1 0 input capture in gr on falling edge at tio2x pin (gr cannot be written to) 1 input capture in gr on both rising and falling edges at tio2x pin (gr cannot be written to) x = a, c, e, or g timer i/o control registers 3a, 3b, 4a, 4b, 5a, 5b (tior3a, tior3b, tior4a, tior4b, tior5a, tior5b) tior3a, tior4a, tior5a bit: 7 6 5 4 3 2 1 0 ccixb ioxb2 ioxb1 ioxb0 ccixa ioxa2 ioxa1 ioxa0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w x = 3 to 5
227 tior3b, tior4b, tior5b bit: 7 6 5 4 3 2 1 0 ccixd ioxd2 ioxd1 ioxd0 ccixc ioxc2 ioxc1 ioxc0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w x = 3 to 5 tior3a, tior3b, tior4a, tior4b, tior5a, and tior5b specify whether general registers gr3a to gr3d, gr4a to gr4d, and gr5a to gr5d are used as input capture or compare- match registers, and also perform edge detection and output value setting. they also select enabling or disabling of free-running counter (tcnt3 to tcnt5) clearing. each tior is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bit 7?lear counter enable flag 3b, 4b, 5b, 3d, 4d, 5d (cci3b, cci4b, cci5b, cci3d, cci4d, cci5d): these bits select enabling or disabling of free-running counter (tcnt) clearing. bit 7: ccixx description 0 tcnt clearing disabled (initial value) 1 tcnt cleared on gr compare-match xx = 3b, 4b, 5b, 3d, 4d, or 5d tcnt is cleared on compare-match only when gr is functioning as an output compare register.
228 ? bits 6 to 4?/o control 3b2 to 3b0, 4b2 to 4b0, 5b2 to 5b0, 3d2 to 3d0, 4d2 to 4d0, 5d2 to 5d0 (io3b2 to io3b0, io4b2 to io4b0, io5b2 to io5b0, io3d2 to io3d0, io4d2 to io4d0, io5d2 to io5d0): these bits select the general register (gr) function. bit 6: ioxx2 bit 5: ioxx1 bit 4: ioxx0 description 0 0 0 gr is an output compare register compare-match disabled; pin output undefined (initial value) 1 0 output on gr compare-match 1 0 1 output on gr compare-match 1 toggle output on gr compare-match 1 0 0 gr is an input capture register input capture disabled (input capture by channel 3 and 9 compare-match enabled) (in channel 3 only, gr cannot be written to) 1 input capture in gr on rising edge at tioxx pin (gr cannot be written to) 1 0 input capture in gr on falling edge at tioxx pin (gr cannot be written to) 1 input capture in gr on both rising and falling edges at tioxx pin (gr cannot be written to) xx = 3b, 4b, 5b, 3d, 4d, or 5d ? bit 3?lear counter enable flag 3a, 4a, 5a, 3c, 4c, 5c (cci3a, cci4a, cci5a, cci3c, cci4c, cci5c): these bits select enabling or disabling of free-running counter (tcnt) clearing. bit 3: ccixx description 0 tcnt clearing disabled (initial value) 1 tcnt cleared on gr compare-match xx = 3a, 4a, 5a, 3c, 4c, or 5c tcnt is cleared on compare-match only when gr is functioning as an output compare register.
229 ? bits 2 to 0?/o control 3a2 to 3a0, 4a2 to 4a0, 5a2 to 5a0, 3c2 to 3c0, 4c2 to 4c0, 5c2 to 5c0 (io3a2 to io3a0, io4a2 to io4a0, io5a2 to io5a0, io3c2 to io3c0, io4c2 to io4c0, io5c2 to io5c0): these bits select the general register (gr) function. bit 2: ioxx2 bit 1: ioxx1 bit 0: ioxx0 description 0 0 0 gr is an output compare register compare-match disabled; pin output undefined (initial value) 1 0 output on gr compare-match 1 0 1 output on gr compare-match 1 toggle output on gr compare-match 1 0 0 gr is an input capture register input capture disabled (input capture by channel 3 and 9 compare-match enabled) (in channel 3 only, gr cannot be written to) 1 input capture in gr on rising edge at tioxx pin (gr connot be written to) 1 0 input capture in gr on falling edge at tioxx pin (gr connot be written to) 1 input capture in gr on both rising and falling edges at tioxx pin (gr connot be written to) xx = 3a, 4a, 5a, 3c, 4c, or 5c
230 timer i/o control register 11 (tior11) tior11 bit: 7 6 5 4 3 2 1 0 ??? io11b0 ??? io11a0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r/w r r/w r/w r/w tior11 specifies whether general registers gr11a and gr11b are used as input capture or compare-match registers, and also performs edge detection and output value setting. tior11 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bits 7 to 5?eserved: these bits always reads 0. the write value should always be 0. ? bit 4?/o control 11b0 (io11b0): these bits select the general register (gr) function. bit 4: io11b0 description 0 compare-match is disabled (initial value) 1 ccompare-match is enabled ? bits 3 to 1?eserved: these bits always reads 0. the write value should always be 0. ? bit 0?/o control 11a0 (io11a0): this bit select the general register (gr) function. bit 0: io11a0 description 0 compare-match is disabled (initial value) 1 ccompare-match is enabled
231 10.2.5 timer status registers (tsr) the timer status registers (tsr) are 16-bit registers. the atu-ii has 11 tsr registers: one each for channels 0, 6 to 9, and 11, two each for channels 1 and 2, and one for channels 3 to 5. for details of channel 10, see section 10.2.26, channel 10 registers. channel abbreviation function 0 tsr0 indicates input capture, interval interrupt, and overflow status 1 tsr1a, tsr1b indicate input capture, compare-match, and overflow status 2 tsr2a, tsr2b 3 tsr3 indicates input capture, compare-match, and overflow status 4 5 6 tsr6 indicate cycle register compare-match status 7 tsr7 8 tsr8 indicates down-counter output end (low) status 9 tsr9 indicates event counter compare-match status 11 tsr11 indicates compare-match and overflow status the tsr registers are 16-bit readable/writable registers containing flags that indicate free-running counter (tcnt) overflow, channel 0 input capture or interval interrupt generation, channel 3, 4, 5, and 11 general register input capture or compare-match, channel 6 and 7 compare-matches, channel 8 down-counter output end, and channel 9 event counter compare-matches. each flag is an interrupt source, and issues an interrupt request to the cpu if the interrupt is enabled by the corresponding bit in the timer interrupt enable register (tier). each tsr is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode.
232 timer status register 0 (tsr0) tsr0 indicates the status of channel 0 interval interrupts, input capture, and overflow. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 iif2b iif2a iif1 ovf0 icf0d icf0c icf0b icf0a initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. ? bits 15 to 8?eserved: these bits always read 0. the write value should always be 0. ? bit 7?nterval interrupt flag 2b (iif2b): status flag that indicates the generation of an interval interrupt. bit 7: iif2b description 0 [clearing condition] (initial value) when iif2b is read while set to 1, then 0 is written to iif2b 1 [setting condition] when interval interrupt selected by itvrr2b is generated ? bit 6?nterval interrupt flag 2a (iif2a): status flag that indicates the generation of an interval interrupt. bit 6: iif2a description 0 [clearing condition] (initial value) when iif2a is read while set to 1, then 0 is written to iif2a 1 [setting condition] when interval interrupt selected by itvrr2a is generated
233 ? bit 5?nterval interrupt flag 1 (iif1): status flag that indicates the generation of an interval interrupt. bit 5: iif1 description 0 [clearing condition] (initial value) when iif1 is read while set to 1, then 0 is written to iif1 1 [setting condition] when interval interrupt selected by itvrr1 is generated ? bit 4?verflow flag 0 (ovf0): status flag that indicates tcnt0 overflow. bit 4: ovf0 description 0 [clearing condition] (initial value) when ovf0 is read while set to 1, then 0 is written to ovf0 1 [setting condition] when the tcnt0 value overflows (from h'ffffffff to h'00000000) ? bit 3?nput capture flag 0d (icf0d): status flag that indicates icr0d input capture. bit 3: icf0d description 0 [clearing condition] (initial value) when icf0d is read while set to 1, then 0 is written to icf0d 1 [setting condition] when the tcnt0 value is transferred to the input capture register by an input capture signal. also set by input capture with a channel 10 compare match as the trigger ? bit 2?nput capture flag 0c (icf0c): status flag that indicates icr0c input capture. bit 2: icf0c description 0 [clearing condition] (initial value) when icf0c is read while set to 1, then 0 is written to icf0c 1 [setting condition] when the tcnt0 value is transferred to the input capture register by an input capture signal
234 ? bit 1?nput capture flag 0b (icf0b): status flag that indicates icr0b input capture. bit 1: icf0b description 0 [clearing condition] (initial value) when icf0b is read while set to 1, then 0 is written to icf0b 1 [setting condition] when the tcnt0 value is transferred to the input capture register by an input capture signal ? bit 0?nput capture flag 0a (icf0a): status flag that indicates icr0a input capture. bit 0: icf0a description 0 [clearing condition] (initial value) when icf0a is read while set to 1, then 0 is written to icf0a 1 [setting condition] when the tcnt0 value is transferred to the input capture register by an input capture signal timer status registers 1a and 1b (tsr1a, tsr1b) tsr1a: tsr1a indicates the status of channel 1 input capture, compare-match, and overflow. bit: 15 14 13 12 11 10 9 8 ??????? ovf1a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/(w) * bit: 7 6 5 4 3 2 1 0 imf1h imf1g imf1f imf1e imf1d imf1c imf1b imf1a initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0.
235 ? bit 8?verflow flag 1a (ovf1a): status flag that indicates tcnt1a overflow. bit 8: ovf1a description 0 [clearing condition] (initial value) when ovf1a is read while set to 1, then 0 is written to ovf1a 1 [setting condition] when the tcnt1a value overflows (from h'ffff to h'0000) ? bit 7?nput capture/compare-match flag 1h (imf1h): status flag that indicates gr1h input capture or compare-match. bit 7: imf1h description 0 [clearing condition] (initial value) when imf1h is read while set to 1, then 0 is written to imf1h 1 [setting conditions] ? when the tcnt1a value is transferred to gr1h by an input capture signal while gr1h is functioning as an input capture register ? ? ? ? when tcnt1a = gr1h while gr1h is functioning as an output compare register ? bit 6?nput capture/compare-match flag 1g (imf1g): status flag that indicates gr1g input capture or compare-match. bit 6: imf1g description 0 [clearing condition] (initial value) when imf1g is read while set to 1, then 0 is written to imf1g 1 [setting conditions] ? ? ? ? when the tcnt1a value is transferred to gr1g by an input capture signal while gr1g is functioning as an input capture register ? ? ? ? when tcnt1a = gr1g while gr1g is functioning as an output compare register
236 ? bit 5?nput capture/compare-match flag 1f (imf1f): status flag that indicates gr1f input capture or compare-match. bit 5: imf1f description 0 [clearing condition] (initial value) when imf1f is read while set to 1, then 0 is written to imf1f 1 [setting conditions] ? ? ? ? when the tcnt1a value is transferred to gr1f by an input capture signal while gr1f is functioning as an input capture register ? ? ? ? when tcnt1a = gr1f while gr1f is functioning as an output compare register ? bit 4?nput capture/compare-match flag 1e (imf1e): status flag that indicates gr1e input capture or compare-match. bit 4: imf1e description 0 [clearing condition] (initial value) when imf1e is read while set to 1, then 0 is written to imf1e 1 [setting conditions] ? ? ? ? when the tcnt1a value is transferred to gr1e by an input capture signal while gr1e is functioning as an input capture register ? ? ? ? when tcnt1a = gr1e while gr1e is functioning as an output compare register ? bit 3?nput capture/compare-match flag 1d (imf1d): status flag that indicates gr1d input capture or compare-match. bit 3: imf1d description 0 [clearing condition] (initial value) when imf1d is read while set to 1, then 0 is written to imf1d 1 [setting conditions] ? ? ? ? when the tcnt1a value is transferred to gr1d by an input capture signal while gr1d is functioning as an input capture register ? ? ? ? when tcnt1a = gr1d while gr1d is functioning as an output compare register
237 ? bit 2?nput capture/compare-match flag 1c (imf1c): status flag that indicates gr1c input capture or compare-match. bit 2: imf1c description 0 [clearing condition] (initial value) when imf1c is read while set to 1, then 0 is written to imf1c 1 [setting conditions] ? ? ? ? when the tcnt1a value is transferred to gr1c by an input capture signal while gr1c is functioning as an input capture register ? ? ? ? when tcnt1a = gr1c while gr1c is functioning as an output compare register ? bit 1?nput capture/compare-match flag 1b (imf1b): status flag that indicates gr1b input capture or compare-match. bit 1: imf1b description 0 [clearing condition] (initial value) when imf1b is read while set to 1, then 0 is written to imf1b 1 [setting conditions] ? when the tcnt1a value is transferred to gr1b by an input capture signal while gr1b is functioning as an input capture register ? ? ? ? when tcnt1a = gr1b while gr1b is functioning as an output compare register ? bit 0?nput capture/compare-match flag 1a (imf1a): status flag that indicates gr1a input capture or compare-match. bit 0: imf1a description 0 [clearing condition] (initial value) when imf1a is read while set to 1, then 0 is written to imf1a 1 [setting conditions] ? when the tcnt1a value is transferred to gr1a by an input capture signal while gr1a is functioning as an input capture register ? ? ? ? when tcnt1a = gr1a while gr1a is functioning as an output compare register
238 tsr1b: tsr1b indicates the status of channel 1 compare-match and overflow. bit: 15 14 13 12 11 10 9 8 ??????? ovf1b initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/(w) * bit: 7 6 5 4 3 2 1 0 ??????? cmf1 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/(w) * note: * only 0 can be written, to clear the flag. ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow flag 1b (ovf1b): status flag that indicates tcnt1b overflow. bit 8: ovf1b description 0 [clearing condition] (initial value) when ovf1b is read while set to 1, then 0 is written to ovf1b 1 [setting condition] when the tcnt1b value overflows (from h'ffff to h'0000) ? bits 7 to 1?eserved: these bits always read 0. the write value should always be 0. ? bit 0?ompare-match flag 1 (cmf1): status flag that indicates ocr1 compare-match. bit 0: cmf1 description 0 [clearing condition] (initial value) when cmf1 is read while set to 1, then 0 is written to cmf1 1 [setting condition] when tcnt1b = ocr1
239 timer status registers 2a and 2b (tsr2a, tsr2b) tsr2a: tsr2a indicates the status of channel 2 input capture, compare-match, and overflow. bit: 15 14 13 12 11 10 9 8 ??????? ovf2a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/(w) * bit: 7 6 5 4 3 2 1 0 imf2h imf2g imf2f imf2e imf2d imf2c imf2b imf2a initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow flag 2a (ovf2a): status flag that indicates tcnt2a overflow. bit 8: ovf2a description 0 [clearing condition] (initial value) when ovf2a is read while set to 1, then 0 is written to ovf2a 1 [setting condition] when the tcnt2a value overflows (from h'ffff to h'0000) ? bit 7?nput capture/compare-match flag 2h (imf2h): status flag that indicates gr2h input capture or compare-match. bit 7: imf2h description 0 [clearing condition] (initial value) when imf2h is read while set to 1, then 0 is written to imf2h 1 [setting conditions] ? when the tcnt2a value is transferred to gr2h by an input capture signal while gr2h is functioning as an input capture register ? ? ? ? when tcnt2a = gr2h while gr2h is functioning as an output compare register
240 ? bit 6?nput capture/compare-match flag 2g (imf2g): status flag that indicates gr2g input capture or compare-match. bit 6: imf2g description 0 [clearing condition] (initial value) when imf2g is read while set to 1, then 0 is written to imf2g 1 [setting conditions] ? when the tcnt2a value is transferred to gr2g by an input capture signal while gr2g is functioning as an input capture register ? ? ? ? when tcnt2a = gr2g while gr2g is functioning as an output compare register ? bit 5?nput capture/compare-match flag 2f (imf2f): status flag that indicates gr2f input capture or compare-match. bit 5: imf2f description 0 [clearing condition] (initial value) when imf2f is read while set to 1, then 0 is written to imf2f 1 [setting conditions] ? when the tcnt2a value is transferred to gr2f by an input capture signal while gr2f is functioning as an input capture register ? ? ? ? when tcnt2a = gr2f while gr2f is functioning as an output compare register ? bit 4?nput capture/compare-match flag 2e (imf2e): status flag that indicates gr2e input capture or compare-match. bit 4: imf2e description 0 [clearing condition] (initial value) when imf2e is read while set to 1, then 0 is written to imf2e 1 [setting conditions] ? when the tcnt2a value is transferred to gr2e by an input capture signal while gr2e is functioning as an input capture register ? ? ? ? when tcnt2a = gr2e while gr2e is functioning as an output compare register
241 ? bit 3?nput capture/compare-match flag 2d (imf2d): status flag that indicates gr2d input capture or compare-match. bit 3: imf2d description 0 [clearing condition] (initial value) when imf2d is read while set to 1, then 0 is written to imf2d 1 [setting conditions] ? when the tcnt2a value is transferred to gr2d by an input capture signal while gr2d is functioning as an input capture register ? ? ? ? when tcnt2a = gr2d while gr2d is functioning as an output compare register ? bit 2?nput capture/compare-match flag 2c (imf2c): status flag that indicates gr2c input capture or compare-match. bit 2: imf2c description 0 [clearing condition] (initial value) when imf2c is read while set to 1, then 0 is written to imf2c 1 [setting conditions] ? when the tcnt2a value is transferred to gr2c by an input capture signal while gr2c is functioning as an input capture register ? ? ? ? when tcnt2a = gr2c while gr2c is functioning as an output compare register ? bit 1?nput capture/compare-match flag 2b (imf2b): status flag that indicates gr2b input capture or compare-match. bit 1: imf2b description 0 [clearing condition] (initial value) when imf2b is read while set to 1, then 0 is written to imf2b 1 [setting conditions] ? when the tcnt2a value is transferred to gr2b by an input capture signal while gr2b is functioning as an input capture register ? ? ? ? when tcnt2a = gr2b while gr2b is functioning as an output compare register
242 ? bit 0?nput capture/compare-match flag 2a (imf2a): status flag that indicates gr2a input capture or compare-match. bit 0: imf2a description 0 [clearing condition] (initial value) when imf2a is read while set to 1, then 0 is written to imf2a 1 [setting conditions] ? when the tcnt2a value is transferred to gr2a by an input capture signal while gr2a is functioning as an input capture register ? ? ? ? when tcnt2a = gr2a while gr2a is functioning as an output compare register tsr2b: tsr2b indicates the status of channel 2 compare-match and overflow. bit: 15 14 13 12 11 10 9 8 ??????? ovf2b initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/(w) * bit: 7 6 5 4 3 2 1 0 cmf2h cmf2g cmf2f cmf2e cmf2d cmf2c cmf2b cmf2a initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow flag 2b (ovf2b): status flag that indicates tcnt2b overflow. bit 8: ovf2b description 0 [clearing condition] (initial value) when ovf2b is read while set to 1, then 0 is written to ovf2b 1 [setting condition] when the tcnt2b value overflows (from h'ffff to h'0000)
243 ? bit 7?ompare-match flag 2h (cmf2h): status flag that indicates ocr2h compare-match. bit 7: cmf2h description 0 [clearing condition] (initial value) when cmf2h is read while set to 1, then 0 is written to cmf2h 1 [setting condition] when tcnt2b = ocr2h ? bit 6?ompare-match flag 2g (cmf2g): status flag that indicates ocr2g compare-match. bit 6: cmf2g description 0 [clearing condition] (initial value) when cmf2g is read while set to 1, then 0 is written to cmf2g 1 [setting condition] when tcnt2b = ocr2g ? bit 5?ompare-match flag 2f (cmf2f): status flag that indicates ocr2f compare-match. bit 5: cmf2f description 0 [clearing condition] (initial value) when cmf2f is read while set to 1, then 0 is written to cmf2f 1 [setting condition] when tcnt2b = ocr2f ? bit 4?ompare-match flag 2e (cmf2e): status flag that indicates ocr2e compare-match. bit 4: cmf2e description 0 [clearing condition] (initial value) when cmf2e is read while set to 1, then 0 is written to cmf2e 1 [setting condition] when tcnt2b = ocr2e ? bit 3?ompare-match flag 2d (cmf2d): status flag that indicates ocr2d compare-match. bit 3: cmf2d description 0 [clearing condition] (initial value) when cmf2d is read while set to 1, then 0 is written to cmf2d 1 [setting condition] when tcnt2b = ocr2d
244 ? bit 2?ompare-match flag 2c (cmf2c): status flag that indicates ocr2c compare-match. bit 2: cmf2c description 0 [clearing condition] (initial value) when cmf2c is read while set to 1, then 0 is written to cmf2c 1 [setting condition] when tcnt2b = ocr2c ? bit 1?ompare-match flag 2b (cmf2b): status flag that indicates ocr2b compare-match. bit 1: cmf2b description 0 [clearing condition] (initial value) when cmf2b is read while set to 1, then 0 is written to cmf2b 1 [setting condition] when tcnt2b = ocr2b ? bit 0?ompare-match flag 2a (cmf2a): status flag that indicates ocr2a compare-match. bit 0: cmf2a description 0 [clearing condition] (initial value) when cmf2a is read while set to 1, then 0 is written to cmf2a 1 [setting condition] when tcnt2b = ocr2a timer status register 3 (tsr3) tsr3 indicates the status of channel 3 to 5 input capture, compare-match, and overflow. bit: 15 14 13 12 11 10 9 8 ? ovf5 imf5d imf5c imf5b imf5a ovf4 imf4d initial value: 0 0 0 0 0 0 0 0 r/w: r r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * bit: 7 6 5 4 3 2 1 0 imf4c imf4b imf4a ovf3 imf3d imf3c imf3b imf3a initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag.
245 ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?verflow flag 5 (ovf5): status flag that indicates tcnt5 overflow. bit 14: ovf5 description 0 [clearing condition] (initial value) when ovf5 is read while set to 1, then 0 is written to ovf5 1 [setting condition] when the tcnt5 value overflows (from h'ffff to h'0000) ? bit 13?nput capture/compare-match flag 5d (imf5d): status flag that indicates gr5d input capture or compare-match. bit 13: imf5d description 0 [clearing condition] (initial value) when imf5d is read while set to 1, then 0 is written to imf5d 1 [setting conditions] ? when the tcnt5 value is transferred to gr5d by an input capture signal while gr5d is functioning as an input capture register ? ? ? ? when tcnt5 = gr5d while gr5d is functioning as an output compare register ? ? ? ? when tcnt5 = gr5d while gr5d is functioning as a synchronous register in pwm mode ? bit 12?nput capture/compare-match flag 5c (imf5c): status flag that indicates gr5c input capture or compare-match. the flag is not set in pwm mode. bit 12: imf5c description 0 [clearing condition] (initial value) when imf5c is read while set to 1, then 0 is written to imf5c 1 [setting conditions] ? when the tcnt5 value is transferred to gr5c by an input capture signal while gr5c is functioning as an input capture register ? ? ? ? when tcnt5 = gr5c while gr5c is functioning as an output compare register
246 ? bit 11?nput capture/compare-match flag 5b (imf5b): status flag that indicates gr5b input capture or compare-match. the flag is not set in pwm mode. bit 11: imf5b description 0 [clearing condition] (initial value) when imf5b is read while set to 1, then 0 is written to imf5b 1 [setting conditions] ? when the tcnt5 value is transferred to gr5b by an input capture signal while gr5b is functioning as an input capture register ? ? ? ? when tcnt5 = gr5b while gr5b is functioning as an output compare register ? bit 10?nput capture/compare-match flag 5a (imf5a): status flag that indicates gr5a input capture or compare-match. the flag is not set in pwm mode. bit 10: imf5a description 0 [clearing condition] (initial value) when imf5a is read while set to 1, then 0 is written to imf5a 1 [setting conditions] ? when the tcnt5 value is transferred to gr5a by an input capture signal while gr5a is functioning as an input capture register ? ? ? ? when tcnt5 = gr5a while gr5a is functioning as an output compare register ? bit 9?verflow flag 4 (ovf4): status flag that indicates tcnt4 overflow. bit 9: ovf4 description 0 [clearing condition] (initial value) when ovf4 is read while set to 1, then 0 is written to ovf4 1 [setting condition] when the tcnt4 value overflows (from h'ffff to h'0000)
247 ? bit 8?nput capture/compare-match flag 4d (imf4d): status flag that indicates gr4d input capture or compare-match. bit 8: imf4d description 0 [clearing condition] (initial value) when imf4d is read while set to 1, then 0 is written to imf4d 1 [setting conditions] ? when the tcnt4 value is transferred to gr4d by an input capture signal while gr4d is functioning as an input capture register ? ? ? ? when tcnt4 = gr4d while gr4d is functioning as an output compare register ? ? ? ? when tcnt4 = gr4d while gr4d is functioning as a pwm mode synchronous register ? bit 7?nput capture/compare-match flag 4c (imf4c): status flag that indicates gr4c input capture or compare-match. the flag is not set in pwm mode. bit 7: imf4c description 0 [clearing condition] (initial value) when imf4c is read while set to 1, then 0 is written to imf4c 1 [setting conditions] ? when the tcnt4 value is transferred to gr4c by an input capture signal while gr4c is functioning as an input capture register ? ? ? ? when tcnt4 = gr4c while gr4c is functioning as an output compare register ? bit 6?nput capture/compare-match flag 4b (imf4b): status flag that indicates gr4b input capture or compare-match. the flag is not set in pwm mode. bit 6: imf4b description 0 [clearing condition] (initial value) when imf4b is read while set to 1, then 0 is written to imf4b 1 [setting conditions] ? when the tcnt4 value is transferred to gr4b by an input capture signal while gr4b is functioning as an input capture register ? ? ? ? when tcnt4 = gr4b while gr4b is functioning as an output compare register
248 ? bit 5?nput capture/compare-match flag 4a (imf4a): status flag that indicates gr4a input capture or compare-match. the flag is not set in pwm mode. bit 5: imf4a description 0 [clearing condition] (initial value) when imf4a is read while set to 1, then 0 is written to imf4a 1 [setting conditions] ? when the tcnt4 value is transferred to gr4a by an input capture signal while gr4a is functioning as an input capture register ? ? ? ? when tcnt4 = gr4a while gr4a is functioning as an output compare register ? bit 4?verflow flag 3 (ovf3): status flag that indicates tcnt3 input capture or compare- match. bit 4: ovf3 description 0 [clearing condition] (initial value) when ovf3 is read while set to 1, then 0 is written to ovf3 1 [setting condition] when the tcnt3 value overflows (from h'ffff to h'0000) ? bit 3?nput capture/compare-match flag 3d (imf3d): status flag that indicates gr5d input capture or compare-match. bit 3: imf3d description 0 [clearing condition] (initial value) when imf3d is read while set to 1, then 0 is written to imf3d 1 [setting conditions] ? when the tcnt3 value is transferred to gr3d by an input capture signal while gr3d is functioning as an input capture register. however, imf3d is not set by input capture with a channel 9 compare match as the trigger ? ? ? ? when tcnt3 = gr3d while gr3d is functioning as an output compare register ? ? ? ? when tcnt3 = gr3d while gr3d is functioning as a synchronous register in pwm mode
249 ? bit 2?nput capture/compare-match flag 3c (imf3c): status flag that indicates gr3c input capture or compare-match. the flag is not set in pwm mode. bit 2: imf3c description 0 [clearing condition] (initial value) when imf3c is read while set to 1, then 0 is written to imf3c 1 [setting conditions] ? when the tcnt3 value is transferred to gr3c by an input capture signal while gr3c is functioning as an input capture register. however, imf3c is not set by input capture with a channel 9 compare match as the trigger ? ? ? ? when tcnt3 = gr3c while gr3c is functioning as an output compare register ? bit 1?nput capture/compare-match flag 3b (imf3b): status flag that indicates gr3b input capture or compare-match. the flag is not set in pwm mode. bit 1: imf3b description 0 [clearing condition] (initial value) when imf3b is read while set to 1, then 0 is written to imf3b 1 [setting conditions] ? when the tcnt3 value is transferred to gr3b by an input capture signal while gr3b is functioning as an input capture register. however, imf3b is not set by input capture with a channel 9 compare match as the trigger ? ? ? ? when tcnt3 = gr3b while gr3b is functioning as an output compare register ? bit 0?nput capture/compare-match flag 3a (imf3a): status flag that indicates gr3a input capture or compare-match. the flag is not set in pwm mode. bit 0: imf3a description 0 [clearing condition] (initial value) when imf3a is read while set to 1, then 0 is written to imf3a 1 [setting conditions] ? when the tcnt3 value is transferred to gr3a by an input capture signal while gr3a is functioning as an input capture register. however, imf3a is not set by input capture with a channel 9 compare match as the trigger ? ? ? ? when tcnt3 = gr3a while gr3a is functioning as an output compare register
250 timer status registers 6 and 7 (tsr6, tsr7) tsr6 and trs7 indicate the channel 6 and 7 free-running counter up-count and down-count status, and cycle register compare status. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 udxd udxc udxb udxa cmfxd cmfxc cmfxb cmfxa initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. x = 6 or 7 udxa to udxd relate to tsr6 only. bits relating to tsr7 always read 0. ? bits 15 to 8?eserved: these bits always read 0. the write value should always be 0. ? bit 7?ount-up/count-down flag 6d (ud6d): status flag that indicates the tcnt6d count operation. bit 7: ud6d description 0 free-running counter tcnt6d operates as an up-counter 1 free-running counter tcnt6d operates as a down-counter ? bit 6?ount-up/count-down flag 6c (ud6c): status flag that indicates the tcnt6c count operation. bit 6: ud6c description 0 free-running counter tcnt6c operates as an up-counter 1 free-running counter tcnt6c operates as a down-counter
251 ? bit 5?ount-up/count-down flag 6b (ud6b): status flag that indicates the tcnt6b count operation. bit 5: ud6b description 0 free-running counter tcnt6b operates as an up-counter 1 free-running counter tcnt6b operates as a down-counter ? bit 4?ount-up/count-down flag 6a (ud6a): status flag that indicates the tcnt6a count operation. bit 4: ud6a description 0 free-running counter tcnt6a operates as an up-counter 1 free-running counter tcnt6a operates as a down-counter ? bit 3?ycle register compare-match flag 6d/7d (cmf6d/cmf7d): status flag that indicates cylrxd compare-match. bit 3: cmfxd description 0 [clearing condition] (initial value) when cmfxd is read while set to 1, then 0 is written to cmfxd 1 [setting conditions] ? when tcntxd = cylrxd (in non-complementary pwm mode) ? ? ? ? when tcnt6d = h'0000 in a down-count (in complementary pwm mode) x = 6 or 7 ? bit 2?ycle register compare-match flag 6c/7c (cmf6c/cmf7c): status flag that indicates cylrxc compare-match. bit 2: cmfxc description 0 [clearing condition] (initial value) when cmfxc is read while set to 1, then 0 is written to cmfxc 1 [setting conditions] ? when tcntxc = cylrxc (in non-complementary pwm mode) ? ? ? ? when tcnt6c = h'0000 in a down-count (in complementary pwm mode) x = 6 or 7
252 ? bit 1?ycle register compare-match flag 6b/7b (cmf6b/cmf7b): status flag that indicates cylrxb compare-match. bit 1: cmfxb description 0 [clearing condition] (initial value) when cmfxb is read while set to 1, then 0 is written to cmfxb 1 [setting conditions] ? when tcntxb = cylrxb (in non-complementary pwm mode) ? ? ? ? when tcnt6b = h'0000 in a down-count (in complementary pwm mode) x = 6 or 7 ? bit 0?ycle register compare-match flag 6a/7a (cmf6a/cmf7a): status flag that indicates cylrxa compare-match. bit 0: cmfxa description 0 [clearing condition] (initial value) when cmfxa is read while set to 1, then 0 is written to cmfxa 1 [setting conditions] ? when tcntxa = cylrxa (in non-complementary pwm mode) ? ? ? ? when tcnt6a = h'0000 in a down-count (in complementary pwm mode) x = 6 or 7 timer status register 8 (tsr8) tsr8 indicates the channel 8 one-shot pulse status. bit: 15 14 13 12 11 10 9 8 osf8p osf8o osf8n osf8m osf8l osf8k osf8j osf8i initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * bit: 7 6 5 4 3 2 1 0 osf8h osf8g osf8f osf8e osf8d osf8c osf8b osf8a initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag.
253 ? bit 15?ne-shot pulse flag 8p (osf8p): status flag that indicates a dcnt8p one-shot pulse. bit 15: osf8p description 0 [clearing condition] (initial value) when osf8p is read while set to 1, then 0 is written to osf8p 1 [setting condition] when dcnt8p underflows ? bit 14?ne-shot pulse flag 8o (osf8o): status flag that indicates a dcnt8o one-shot pulse. bit 14: osf8o description 0 [clearing condition] (initial value) when osf8o is read while set to 1, then 0 is written to osf8o 1 [setting condition] when dcnt8o underflows ? bit 13?ne-shot pulse flag 8n (osf8n): status flag that indicates a dcnt8n one-shot pulse. bit 13: osf8n description 0 [clearing condition] (initial value) when osf8n is read while set to 1, then 0 is written to osf8n 1 [setting condition] when dcnt8n underflows ? bit 12?ne-shot pulse flag 8m (osf8m): status flag that indicates a dcnt8m one-shot pulse. bit 12: osf8m description 0 [clearing condition] (initial value) when osf8m is read while set to 1, then 0 is written to osf8m 1 [setting condition] when dcnt8m underflows
254 ? bit 11?ne-shot pulse flag 8l (osf8l): status flag that indicates a dcnt8l one-shot pulse. bit 11: osf8l description 0 [clearing condition] (initial value) when osf8l is read while set to 1, then 0 is written to osf8l 1 [setting condition] when dcnt8l underflows ? bit 10?ne-shot pulse flag 8k (osf8k): status flag that indicates a dcnt8k one-shot pulse. bit 10: osf8k description 0 [clearing condition] (initial value) when osf8k is read while set to 1, then 0 is written to osf8k 1 [setting condition] when dcnt8k underflows ? bit 9?ne-shot pulse flag 8j (osf8j): status flag that indicates a dcnt8j one-shot pulse. bit 9: osf8j description 0 [clearing condition] (initial value) when osf8j is read while set to 1, then 0 is written to osf8j 1 [setting condition] when dcnt8j underflows ? bit 8?ne-shot pulse flag 8i (osf8i): status flag that indicates a dcnt8i one-shot pulse. bit 8: osf8i description 0 [clearing condition] (initial value) when osf8i is read while set to 1, then 0 is written to osf8i 1 [setting condition] when dcnt8i underflows
255 ? bit 7?ne-shot pulse flag 8h (osf8h): status flag that indicates a dcnt8h one-shot pulse. bit 7: osf8h description 0 [clearing condition] (initial value) when osf8h is read while set to 1, then 0 is written to osf8h 1 [setting condition] when dcnt8h underflows ? bit 6?ne-shot pulse flag 8g (osf8g): status flag that indicates a dcnt8g one-shot pulse. bit 6: osf8g description 0 [clearing condition] (initial value) when osf8g is read while set to 1, then 0 is written to osf8g 1 [setting condition] when dcnt8g underflows ? bit 5?ne-shot pulse flag 8f (osf8f): status flag that indicates a dcnt8f one-shot pulse. bit 5: osf8f description 0 [clearing condition] (initial value) when osf8f is read while set to 1, then 0 is written to osf8f 1 [setting condition] when dcnt8f underflows ? bit 4?ne-shot pulse flag 8e (osf8e): status flag that indicates a dcnt8e one-shot pulse. bit 4: osf8e description 0 [clearing condition] (initial value) when osf8e is read while set to 1, then 0 is written to osf8e 1 [setting condition] when dcnt8e underflows
256 ? bit 3?ne-shot pulse flag 8d (osf8d): status flag that indicates a dcnt8d one-shot pulse. bit 3: osf8d description 0 [clearing condition] (initial value) when osf8d is read while set to 1, then 0 is written to osf8d 1 [setting condition] when dcnt8d underflows ? bit 2?ne-shot pulse flag 8c (osf8c): status flag that indicates a dcnt8c one-shot pulse. bit 2: osf8c description 0 [clearing condition] (initial value) when osf8c is read while set to 1, then 0 is written to osf8c 1 [setting condition] when dcnt8c underflows ? bit 1?ne-shot pulse flag 8b (osf8b): status flag that indicates a dcnt8b one-shot pulse. bit 1: osf8b description 0 [clearing condition] (initial value) when osf8b is read while set to 1, then 0 is written to osf8b 1 [setting condition] when dcnt8b underflows ? bit 0?ne-shot pulse flag 8a (osf8a): status flag that indicates a dcnt8a one-shot pulse. bit 0: osf8a description 0 [clearing condition] (initial value) when osf8a is read while set to 1, then 0 is written to osf8a 1 [setting condition] when dcnt8a underflows
257 timer status register 9 (tsr9) tsr9 indicates the channel 9 event counter compare-match status. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ?? cmf9f cmf9e cmf9d cmf9c cmf9b cmf9a initial value: 0 0 0 0 0 0 0 0 r/w: r r r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. ? bits 15 to 6?eserved: these bits always read 0. the write value should always be 0. ? bit 5?ompare-match flag 9f (cmf9f): status flag that indicates gr9f compare-match. bit 5: cmf9f description 0 [clearing condition] (initial value) when cmf9f is read while set to 1, then 0 is written to cmf9f 1 [setting condition] when the next edge is input while ecnt9f = gr9f ? bit 4?ompare-match flag 9e (cmf9e): status flag that indicates gr9e compare-match. bit 4: cmf9e description 0 [clearing condition] (initial value) when cmf9e is read while set to 1, then 0 is written to cmf9e 1 [setting condition] when the next edge is input while ecnt9e = gr9e
258 ? bit 3?ompare-match flag 9d (cmf9d): status flag that indicates gr9d compare-match. bit 3: cmf9d description 0 [clearing condition] (initial value) when cmf9d is read while set to 1, then 0 is written to cmf9d 1 [setting condition] when the next edge is input while ecnt9d = gr9d ? bit 2?ompare-match flag 9c (cmf9c): status flag that indicates gr9c compare-match. bit 2: cmf9c description 0 [clearing condition] (initial value) when cmf9c is read while set to 1, then 0 is written to cmf9c 1 [setting condition] when the next edge is input while ecnt9c = gr9c ? bit 1?ompare-match flag 9b (cmf9b): status flag that indicates gr9b compare-match. bit 1: cmf9b description 0 [clearing condition] (initial value) when cmf9b is read while set to 1, then 0 is written to cmf9b 1 [setting condition] when the next edge is input while ecnt9b = gr9b ? bit 0?ompare-match flag 9a (cmf9a): status flag that indicates gr9a compare-match. bit 0: cmf9a description 0 [clearing condition] (initial value) when cmf9a is read while set to 1, then 0 is written to cmf9a 1 [setting condition] when the next edge is input while ecnt9a = gr9a
259 timer status register 11 (tsr11) tsr11 indicates the status of channel 11 compare-match and overflow. bit: 15 14 13 12 11 10 9 8 ??????? ovf11 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/(w) * bit: 7 6 5 4 3 2 1 0 ?????? imf11b imf11a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow flag 11 (ovf11): status flag that indicates tcnt11 overflow. bit 8: ovf11 description 0 [clearing condition] (initial value) when ovf11 is read while set to 1, then 0 is written to ovf11 1 [setting condition] when the tcnt11 value overflows (from h'ffff to h'0000) ? bits 7 to 2?eserved: these bits always read 0. the write value should always be 0. ? bit 1?ompare-match flag 11b (imf11b): status flag that indicates gr11b compare-match. bit 1: imf11b description 0 [clearing condition] (initial value) when imf11b is read while set to 1, then 0 is written to imf11b 1 [setting condition] when tcnt11 = gr11b while gr11b is functioning as an output compare register
260 ? bit 0?ompare-match flag 11a (imf11a): status flag that indicates gr11a compare- match. bit 0: imf11a description 0 [clearing condition] (initial value) when imf11a is read while set to 1, then 0 is written to imf11a 1 [setting condition] when tcnt11 = gr11a while gr11a is functioning as an output compare register 10.2.6 timer interrupt enable registers (tier) the timer interrupt enable registers (tier) are 16-bit registers. the atu-ii has 11 tier registers: one each for channels 0, 6 to 9, and 11, two each for channels 1 and 2, and one for channels 3 to 5. for details of channel 10, see section 10.2.26, channel 10 registers. channel abbreviation function 0 tier0 controls input capture, and overflow interrupt request enabling/disabling. 1 tier1a, tier1b control input capture, compare-match, and overflow interrupt 2 tier2a, tier2b request enabling/disabling. 3 tier3 controls input capture, compare-match, and overflow interrupt 4 request enabling/disabling. 5 6 tier6 control cycle register compare-match interrupt request 7 tier7 enabling/disabling. 8 tier8 controls down-counter output end (low) interrupt request enabling/disabling. 9 tier9 controls event counter compare-match interrupt request enabling/disabling. 11 tier11 controls input capture, compare-match, and overflow interrupt request enabling/disabling. the tier registers are 16-bit readable/writable registers that control enabling and disabling of timer interrupt requests. these cover free-running counter (tcnt) overflow interrupts, channel 0 input capture interrupts, channel 1 to 5 general register input capture/compare-match interrupts, channel 6 and 7 compare-match interrupts, channel 8 down-counter output pin interrupts, channel 9 event counter compare-match interrupts, and channel 11 general register compare-match interrupts.
261 each tier is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. timer interrupt enable register 0 (tier0) tier0 controls enabling/disabling of channel 0 input capture and overflow interrupt requests. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ??? ove0 ice0d ice0c ice0b ice0a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r/w r/w r/w r/w r/w ? bits 15 to 5?eserved: these bits always read 0. the write value should always be 0. ? bit 4?verflow interrupt enable 0 (ove0): enables or disables interrupt requests by the overflow flag (ovf0) in tsr0 when ovf0 is set to 1. bit 4: ove0 description 0 ovi0 interrupt requested by ovf0 is disabled (initial value) 1 ovi0 interrupt requested by ovf0 is enabled ? bit 3?nput capture interrupt enable 0d (ice0d): enables or disables interrupt requests by the input capture flag (icf0d) in tsr0 when icf0d is set to 1. setting the dmac while interrupt requests are enabled allows the dmac to be activated by an interrupt request. bit 3: ice0d description 0 ici0d interrupt requested by icf0d is disabled (initial value) 1 ici0d interrupt requested by icf0d is enabled
262 ? bit 2?nput capture interrupt enable 0c (ice0c): enables or disables interrupt requests by the input capture flag (icf0c) in tsr0 when icf0c is set to 1. setting the dmac while interrupt requests are enabled allows the dmac to be activated by an interrupt request. bit 2: ice0c description 0 ici0c interrupt requested by icf0c is disabled (initial value) 1 ici0c interrupt requested by icf0c is enabled ? bit 1?nput capture interrupt enable 0b (ice0b): enables or disables interrupt requests by the input capture flag (icf0b) in tsr0 when icf0b is set to 1. setting the dmac while interrupt requests are enabled allows the dmac to be activated by an interrupt request. bit 1: ice0b description 0 ici0b interrupt requested by icf0b is disabled (initial value) 1 ici0b interrupt requested by icf0b is enabled ? bit 0?nput capture interrupt enable 0a (ice0a): enables or disables interrupt requests by the input capture flag (icf0a) in tsr0 when icf0a is set to 1. setting the dmac while interrupt requests are enabled allows the dmac to be activated by an interrupt request. bit 0: ice0a description 0 ici0a interrupt requested by icf0a is disabled (initial value) 1 ici0a interrupt requested by icf0a is enabled timer interrupt enable registers 1a and 1b (tier1a, tier1b) tier1a: tier1a controls enabling/disabling of channel 1 input capture, compare-match, and overflow interrupt requests. bit: 15 14 13 12 11 10 9 8 ??????? ove1a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 ime1h ime1g ime1f ime1e ime1d ime1c ime1b ime1a initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
263 ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow interrupt enable 1a (ove1a): enables or disables interrupt requests by ovf1a in tsr1a when ovf1a is set to 1. bit 8: ove1a description 0 ovi1a interrupt requested by ovf1a is disabled (initial value) 1 ovi1a interrupt requested by ovf1a is enabled ? bit 7?nput capture/compare-match interrupt enable 1h (ime1h): enables or disables interrupt requests by imf1h in tsr1a when imf1h is set to 1. bit 7: ime1h description 0 imi1h interrupt requested by imf1h is disabled (initial value) 1 imi1h interrupt requested by imf1h is enabled ? bit 6?nput capture/compare-match interrupt enable 1g (ime1g): enables or disables interrupt requests by imf1g in tsr1a when imf1g is set to 1. bit 6: ime1g description 0 imi1g interrupt requested by imf1g is disabled (initial value) 1 imi1g interrupt requested by imf1g is enabled ? bit 5?nput capture/compare-match interrupt enable 1f (ime1f): enables or disables interrupt requests by imf1f in tsr1a when imf1f is set to 1. bit 5: ime1f description 0 imi1f interrupt requested by imf1f is disabled (initial value) 1 imi1f interrupt requested by imf1f is enabled ? bit 4?nput capture/compare-match interrupt enable 1e (ime1e): enables or disables interrupt requests by imf1e in tsr1a when imf1e is set to 1. bit 4: ime1e description 0 imi1e interrupt requested by imf1e is disabled (initial value) 1 imi1e interrupt requested by imf1e is enabled
264 ? bit 3?nput capture/compare-match interrupt enable 1d (ime1d): enables or disables interrupt requests by imf1d in tsr1a when imf1d is set to 1. bit 3: ime1d description 0 imi1d interrupt requested by imf1d is disabled (initial value) 1 imi1d interrupt requested by imf1d is enabled ? bit 2?nput capture/compare-match interrupt enable 1c (ime1c): enables or disables interrupt requests by imf1c in tsr1a when imf1c is set to 1. bit 2: ime1c description 0 imi1c interrupt requested by imf1c is disabled (initial value) 1 imi1c interrupt requested by imf1c is enabled ? bit 1?nput capture/compare-match interrupt enable 1b (ime1b): enables or disables interrupt requests by imf1b in tsr1a when imf1b is set to 1. bit 1: ime1b description 0 imi1b interrupt requested by imf1b is disabled (initial value) 1 imi1b interrupt requested by imf1b is enabled ? bit 0?nput capture/compare-match interrupt enable 1a (ime1a): enables or disables interrupt requests by imf1a in tsr1a when imf1a is set to 1. bit 0: ime1a description 0 imi1a interrupt requested by imf1a is disabled (initial value) 1 imi1a interrupt requested by imf1a is enabled
265 tier1b: tier1b controls enabling/disabling of channel 1 compare-match and overflow interrupt requests. bit: 15 14 13 12 11 10 9 8 ??????? ove1b initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 ??????? cme1 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow interrupt enable 1b (ove1b): enables or disables interrupt requests by ovf1b in tsr1b when ovf1b is set to 1. bit 8: ove1b description 0 ovi1b interrupt requested by ovf1b is disabled (initial value) 1 ovi1b interrupt requested by ovf1b is enabled ? bits 7 to 1?eserved: these bits always read 0. the write value should always be 0. ? bit 0?ompare-match interrupt enable 1 (cme1): enables or disables interrupt requests by cmf1 in tsr1b when cmf1 is set to 1. bit 0: cme1 description 0 cmi1 interrupt requested by cmf1 is disabled (initial value) 1 cmi1 interrupt requested by cmf1 is enabled
266 timer interrupt enable registers 2a and 2b (tier2a, tier2b) tier2a: tier2a controls enabling/disabling of channel 2 input capture, compare-match, and overflow interrupt requests. bit: 15 14 13 12 11 10 9 8 ??????? ove2a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 ime2h ime2g ime2f ime2e ime2d ime2c ime2b ime2a initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow interrupt enable 2a (ove2a): enables or disables interrupt requests by ovf2a in tsr2a when ovf2a is set to 1. bit 8: ove2a description 0 ovi2a interrupt requested by ovf2a is disabled (initial value) 1 ovi2a interrupt requested by ovf2a is enabled ? bit 7?nput capture/compare-match interrupt enable 2h (ime2h): enables or disables interrupt requests by imf2h in tsr2a when imf2h is set to 1. bit 7: ime2h description 0 imi2h interrupt requested by imf2h is disabled (initial value) 1 imi2h interrupt requested by imf2h is enabled ? bit 6?nput capture/compare-match interrupt enable 2g (ime2g): enables or disables interrupt requests by imf2g in tsr2a when imf2g is set to 1. bit 6: ime2g description 0 imi2g interrupt requested by imf2g is disabled (initial value) 1 imi2g interrupt requested by imf2g is enabled
267 ? bit 5?nput capture/compare-match interrupt enable 2f (ime2f): enables or disables interrupt requests by imf2f in tsr2a when imf2f is set to 1. bit 5: ime2f description 0 imi2f interrupt requested by imf2f is disabled (initial value) 1 imi2f interrupt requested by imf2f is enabled ? bit 4?nput capture/compare-match interrupt enable 2e (ime2e): enables or disables interrupt requests by imf2e in tsr2a when imf2e is set to 1. bit 4: ime2e description 0 imi2e interrupt requested by imf2e is disabled (initial value) 1 imi2e interrupt requested by imf2e is enabled ? bit 3?nput capture/compare-match interrupt enable 2d (ime2d): enables or disables interrupt requests by imf2d in tsr2a when imf2d is set to 1. bit 3: ime2d description 0 imi2d interrupt requested by imf2d is disabled (initial value) 1 imi2d interrupt requested by imf2d is enabled ? bit 2?nput capture/compare-match interrupt enable 2c (ime2c): enables or disables interrupt requests by imf2c in tsr2a when imf2c is set to 1. bit 2: ime2c description 0 imi2c interrupt requested by imf2c is disabled (initial value) 1 imi2c interrupt requested by imf2c is enabled ? bit 1?nput capture/compare-match interrupt enable 2b (ime2b): enables or disables interrupt requests by imf2b in tsr2a when imf2b is set to 1. bit 1: ime2b description 0 imi2b interrupt requested by imf2b is disabled (initial value) 1 imi2b interrupt requested by imf2b is enabled
268 ? bit 0?nput capture/compare-match interrupt enable 2a (ime2a): enables or disables interrupt requests by imf2a in tsr2a when imf2a is set to 1. bit 0: ime2a description 0 imi2a interrupt requested by imf2a is disabled (initial value) 1 imi2a interrupt requested by imf2a is enabled tier2b: tier2b controls enabling/disabling of channel 2 compare-match and overflow interrupt requests. bit: 15 14 13 12 11 10 9 8 ??????? ove2b initial value: 00000000 r/w: rrrrrrrr/w bit: 76543210 cme2h cme2g cme2f cme2e cme2d cme2c cme2b cme2a initial value: 00000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow interrupt enable 2b (ove2b): enables or disables interrupt requests by ovf2b in tsr2b when ovf2b is set to 1. bit 8: ove2b description 0 ovi2b interrupt requested by ovf2b is disabled (initial value) 1 ovi2b interrupt requested by ovf2b is enabled ? bit 7?ompare-match interrupt enable 2h (cme2h): enables or disables interrupt requests by cmf2f in tsr2b when cmf2h is set to 1. bit 7: cme2h description 0 cmi2h interrupt requested by cmf2h is disabled (initial value) 1 cmi2h interrupt requested by cmf2h is enabled
269 ? bit 6?ompare-match interrupt enable 2g (cme2g): enables or disables interrupt requests by cmf2g in tsr2b when cmf2g is set to 1. bit 6: cme2g description 0 cmi2g interrupt requested by cmf2g is disabled (initial value) 1 cmi2g interrupt requested by cmf2g is enabled ? bit 5?ompare-match interrupt enable 2f (cme2f): enables or disables interrupt requests by cmf2f in tsr2b when cmf2f is set to 1. bit 5: cme2f description 0 cmi2f interrupt requested by cmf2f is disabled (initial value) 1 cmi2f interrupt requested by cmf2f is enabled ? bit 4?ompare-match interrupt enable 2e (cme2e): enables or disables interrupt requests by cmf2e in tsr2b when cmf2e is set to 1. bit 4: cme2e description 0 cmi2e interrupt requested by cmf2e is disabled (initial value) 1 cmi2e interrupt requested by cmf2e is enabled ? bit 3?ompare-match interrupt enable 2d (cme2d): enables or disables interrupt requests by cmf2d in tsr2b when cmf2d is set to 1. bit 3: cme2d description 0 cmi2d interrupt requested by cmf2d is disabled (initial value) 1 cmi2d interrupt requested by cmf2d is enabled ? bit 2?ompare-match interrupt enable 2c (cme2c): enables or disables interrupt requests by cmf2c in tsr2b when cmf2c is set to 1. bit 2: cme2c description 0 cmi2c interrupt requested by cmf2c is disabled (initial value) 1 cmi2c interrupt requested by cmf2c is enabled
270 ? bit 1?ompare-match interrupt enable 2b (cme2bb): enables or disables interrupt requests by cmf2b in tsr2b when cmf2b is set to 1. bit 1: cme2b description 0 cmi2b interrupt requested by cmf2b is disabled (initial value) 1 cmi2b interrupt requested by cmf2b is enabled ? bit 0?ompare-match interrupt enable 2a (cme2a): enables or disables interrupt requests by cmf2a in tsr2b when cmf2a is set to 1. bit 0: cme2a description 0 cmi2a interrupt requested by cmf2a is disabled (initial value) 1 cmi2a interrupt requested by cmf2a is enabled timer interrupt enable register 3 (tier3) tier3 controls enabling/disabling of channel 3 to 5 input capture, compare-match, and overflow interrupt requests. bit: 15 14 13 12 11 10 9 8 ? ove5 ime5d ime5c ime5b ime5a ove4 ime4d initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ime4c ime4b ime4a ove3 ime3d ime3c ime3b ime3a initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?verflow interrupt enable 5 (ove5): enables or disables interrupt requests by ovf5 in tsr3 when ovf5 is set to 1. bit 14: ove5 description 0 ovi5 interrupt requested by ovf5 is disabled (initial value) 1 ovi5 interrupt requested by ovf5 is enabled
271 ? bit 13?nput capture/compare-match interrupt enable 5d (ime5d): enables or disables interrupt requests by imf5d in tsr3 when imf5d is set to 1. bit 13: ime5d description 0 imi5d interrupt requested by imf5d is disabled (initial value) 1 imi5d interrupt requested by imf5d is enabled ? bit 12?nput capture/compare-match interrupt enable 5c (ime5c): enables or disables interrupt requests by imf5c in tsr3 when imf5c is set to 1. bit 12: ime5c description 0 imi5c interrupt requested by imf5c is disabled (initial value) 1 imi5c interrupt requested by imf5c is enabled ? bit 11?nput capture/compare-match interrupt enable 5b (ime5b): enables or disables interrupt requests by imf5b in tsr3 when imf5b is set to 1. bit 11: ime5b description 0 imi5b interrupt requested by imf5b is disabled (initial value) 1 imi5b interrupt requested by imf5b is enabled ? bit 10?nput capture/compare-match interrupt enable 5a (ime5a): enables or disables interrupt requests by imf5a in tsr3 when imf5a is set to 1. bit 10: ime5a description 0 imi5a interrupt requested by imf5a is disabled (initial value) 1 imi5a interrupt requested by imf5a is enabled ? bit 9?verflow interrupt enable 4 (ove4): enables or disables interrupt requests by ovf4 in tsr3 when ovf4 is set to 1. bit 9: ove4 description 0 ovi4 interrupt requested by ovf4 is disabled (initial value) 1 ovi4 interrupt requested by ovf4 is enabled
272 ? bit 8?nput capture/compare-match interrupt enable 4d (ime4d): enables or disables interrupt requests by imf4d in tsr3 when imf4d is set to 1. bit 8: ime4d description 0 imi4d interrupt requested by imf4d is disabled (initial value) 1 imi4d interrupt requested by imf4d is enabled ? bit 7?nput capture/compare-match interrupt enable 4c (ime4c): enables or disables interrupt requests by imf4c in tsr3 when imf4c is set to 1. bit 7: ime4c description 0 imi4c interrupt requested by imf4c is disabled (initial value) 1 imi4c interrupt requested by imf4c is enabled ? bit 6?nput capture/compare-match interrupt enable 4b (ime4b): enables or disables interrupt requests by imf4b in tsr3 when imf4b is set to 1. bit 6: ime4b description 0 imi4b interrupt requested by imf4b is disabled (initial value) 1 imi4b interrupt requested by imf4b is enabled ? bit 5?nput capture/compare-match interrupt enable 4a (ime4a): enables or disables interrupt requests by imf4a in tsr3 when imf4a is set to 1. bit 5: ime4a description 0 imi4a interrupt requested by imf4a is disabled (initial value) 1 imi4a interrupt requested by imf4a is enabled ? bit 4?verflow interrupt enable 3 (ove3): enables or disables interrupt requests by ovf3 in tsr3 when ovf3 is set to 1. bit 4: ove3 description 0 ovi3 interrupt requested by ovf3 is disabled (initial value) 1 ovi3 interrupt requested by ovf3 is enabled
273 ? bit 3?nput capture/compare-match interrupt enable 3d (ime3d): enables or disables interrupt requests by imf3d in tsr3 when imf3d is set to 1. bit 3: ime3d description 0 imi3d interrupt requested by imf3d is disabled (initial value) 1 imi3d interrupt requested by imf3d is enabled ? bit 2?nput capture/compare-match interrupt enable 3c (ime3c): enables or disables interrupt requests by imf3c in tsr3 when imf3c is set to 1. bit 2: ime3c description 0 imi3c interrupt requested by imf3c is disabled (initial value) 1 imi3c interrupt requested by imf3c is enabled ? bit 1?nput capture/compare-match interrupt enable 3b (ime3b): enables or disables interrupt requests by imf3b in tsr3 when imf3b is set to 1. bit 1: ime3b description 0 imi3b interrupt requested by imf3b is disabled (initial value) 1 imi3b interrupt requested by imf3b is enabled ? bit 0?nput capture/compare-match interrupt enable 3a (ime3a): enables or disables interrupt requests by imf3a in tsr3 when imf3a is set to 1. bit 0: ime3a description 0 imi3a interrupt requested by imf3a is disabled (initial value) 1 imi3a interrupt requested by imf3a is enabled
274 timer interrupt enable registers 6 and 7 (tier6, tier7) tier6 and tier7 control enabling/disabling of channel 6 and 7 cycle register compare interrupt requests. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ???? cmexd cmexc cmexb cmexa initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w x = 6 or 7 ? bits 15 to 4?eserved: these bits always read 0. the write value should always be 0. ? bit 3?ycle register compare-match interrupt enable 6d/7d (cme6d/cme7d): enables or disables interrupt requests by cmfxd in tsr6 or tsr7 when cmfxd is set to 1. setting the dmac while interrupt requests are enabled allows the dmac to be activated by an interrupt request. bit 3: cmexd description 0 cmixd interrupt requested by cmfxd is disabled (initial value) 1 cmixd interrupt requested by cmfxd is enabled x = 6 or 7 ? bit 2?ycle register compare-match interrupt enable 6c/7c (cme6c/cme7c): enables or disables interrupt requests by cmfxc in tsr6 or tsr7 when cmfxc is set to 1. setting the dmac while interrupt requests are enabled allows the dmac to be activated by an interrupt request. bit 2: cmexc description 0 cmixc interrupt requested by cmfxc is disabled (initial value) 1 cmixc interrupt requested by cmfxc is enabled x = 6 or 7
275 ? bit 1?ycle register compare-match interrupt enable 6b/7b (cme6b/cme7b): enables or disables interrupt requests by cmfxb in tsr6 or tsr7 when cmfxb is set to 1. setting the dmac while interrupt requests are enabled allows the dmac to be activated by an interrupt request. bit 1: cmexb description 0 cmixb interrupt requested by cmfxb is disabled (initial value) 1 cmixb interrupt requested by cmfxb is enabled x = 6 or 7 ? bit 0?ycle register compare-match interrupt enable 6a/7a (cme6a/cme7a): enables or disables interrupt requests by cmfxa in tsr6 or tsr7 when cmfxa is set to 1. setting the dmac while interrupt requests are enabled allows the dmac to be activated by an interrupt request. bit 0: cmexa description 0 cmixa interrupt requested by cmfxa is disabled (initial value) 1 cmixa interrupt requested by cmfxa is enabled x = 6 or 7 timer interrupt enable register 8 (tier8) tier8 controls enabling/disabling of channel 8 one-shot pulse interrupt requests. bit: 15 14 13 12 11 10 9 8 ose8p ose8o ose8n ose8m ose8l ose8k ose8j ose8i initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ose8h ose8g ose8f ose8e ose8d ose8c ose8b ose8a initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
276 ? bit 15?ne-shot pulse interrupt enable 8p (ose8p): enables or disables interrupt requests by osf8p in tsr8 when osf8p is set to 1. bit 15: ose8p description 0 osi8p interrupt requested by osf8p is disabled (initial value) 1 osi8p interrupt requested by osf8p is enabled ? bit 14?ne-shot pulse interrupt enable 8o (ose8o): enables or disables interrupt requests by osf8o in tsr8 when osf8o is set to 1. bit 14: ose8o description 0 osi8o interrupt requested by osf8o is disabled (initial value) 1 osi8o interrupt requested by osf8o is enabled ? bit 13?ne-shot pulse interrupt enable 8n (ose8n): enables or disables interrupt requests by osf8n in tsr8 when osf8n is set to 1. bit 13: ose8n description 0 osi8n interrupt requested by osf8n is disabled (initial value) 1 osi8n interrupt requested by osf8n is enabled ? bit 12?ne-shot pulse interrupt enable 8m (ose8m): enables or disables interrupt requests by osf8m in tsr8 when osf8m is set to 1. bit 12: ose8m description 0 osi8m interrupt requested by osf8m is disabled (initial value) 1 osi8m interrupt requested by osf8m is enabled ? bit 11?ne-shot pulse interrupt enable 8l (ose8l): enables or disables interrupt requests by osf8l in tsr8 when osf8l is set to 1. bit 11: ose8l description 0 osi8l interrupt requested by osf8l is disabled (initial value) 1 osi8l interrupt requested by osf8l is enabled
277 ? bit 10?ne-shot pulse interrupt enable 8k (ose8k): enables or disables interrupt requests by osf8k in tsr8 when osf8k is set to 1. bit 10: ose8k description 0 osi8k interrupt requested by osf8k is disabled (initial value) 1 osi8k interrupt requested by osf8k is enabled ? bit 9?ne-shot pulse interrupt enable 8j (ose8j): enables or disables interrupt requests by osf8j in tsr8 when osf8j is set to 1. bit 9: ose8j description 0 osi8j interrupt requested by osf8j is disabled (initial value) 1 osi8j interrupt requested by osf8j is enabled ? bit 8?ne-shot pulse interrupt enable 8i (ose8i): enables or disables interrupt requests by osf8i in tsr8 when osf8i is set to 1. bit 8: ose8i description 0 osi8i interrupt requested by osf8i is disabled (initial value) 1 osi8i interrupt requested by osf8i is enabled ? bit 7?ne-shot pulse interrupt enable 8h (ose8h): enables or disables interrupt requests by osf8h in tsr8 when osf8h is set to 1. bit 7: ose8h description 0 osi8h interrupt requested by osf8h is disabled (initial value) 1 osi8h interrupt requested by osf8h is enabled ? bit 6?ne-shot pulse interrupt enable 8g (ose8g): enables or disables interrupt requests by osf8g in tsr8 when osf8g is set to 1. bit 6: ose8g description 0 osi8g interrupt requested by osf8g is disabled (initial value) 1 osi8g interrupt requested by osf8g is enabled
278 ? bit 5?ne-shot pulse interrupt enable 8f (ose8f): enables or disables interrupt requests by osf8f in tsr8 when osf8f is set to 1. bit 5: ose8f description 0 osi8f interrupt requested by osf8f is disabled (initial value) 1 osi8f interrupt requested by osf8f is enabled ? bit 4?ne-shot pulse interrupt enable 8e (ose8e): enables or disables interrupt requests by osf8e in tsr8 when osf8e is set to 1. bit 4: ose8e description 0 osi8e interrupt requested by osf8e is disabled (initial value) 1 osi8e interrupt requested by osf8e is enabled ? bit 3?ne-shot pulse interrupt enable 8d (ose8d): enables or disables interrupt requests by osf8d in tsr8 when osf8d is set to 1. bit 3: ose8d description 0 osi8d interrupt requested by osf8d is disabled (initial value) 1 osi8d interrupt requested by osf8d is enabled ? bit 2?ne-shot pulse interrupt enable 8c (ose8c): enables or disables interrupt requests by osf8c in tsr8 when osf8c is set to 1. bit 2: ose8c description 0 osi8c interrupt requested by osf8c is disabled (initial value) 1 osi8c interrupt requested by osf8c is enabled ? bit 1?ne-shot pulse interrupt enable 8b (ose8b): enables or disables interrupt requests by osf8b in tsr8 when osf8b is set to 1. bit 1: ose8b description 0 osi8b interrupt requested by osf8b is disabled (initial value) 1 osi8b interrupt requested by osf8b is enabled
279 ? bit 0?ne-shot pulse interrupt enable 8a (ose8a): enables or disables interrupt requests by osf8a in tsr8 when osf8a is set to 1. bit 0: ose8a description 0 osi8a interrupt requested by osf8a is disabled (initial value) 1 osi8a interrupt requested by osf8a is enabled timer interrupt enable register 9 (tier9) tier9 controls enabling/disabling of channel 9 event counter compare-match interrupt requests. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ?? cme9f cme9e cme9d cme9c cme9b cme9a initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w ? bits 15 to 6?eserved: these bits always read 0. the write value should always be 0. ? bit 5?ompare-match interrupt enable 9f (cme9f): enables or disables interrupt requests by cmf9f in tsr9 when cmf9f is set to 1. bit 5: cme9f description 0 cmi9f interrupt requested by cmf9f is disabled (initial value) 1 cmi9f interrupt requested by cmf9f is enabled ? bit 4?ompare-match interrupt enable 9e (cme9e): enables or disables interrupt requests by cmf9e in tsr9 when cmf9e is set to 1. bit 4: cme9e description 0 cmi9e interrupt requested by cmf9e is disabled (initial value) 1 cmi9e interrupt requested by cmf9e is enabled
280 ? bit 3?ompare-match interrupt enable 9d (cme9d): enables or disables interrupt requests by cmf9d in tsr9 when cmf9d is set to 1. bit 3: cme9d description 0 cmi9d interrupt requested by cmf9d is disabled (initial value) 1 cmi9d interrupt requested by cmf9d is enabled ? bit 2?ompare-match interrupt enable 9c (cme9c): enables or disables interrupt requests by cmf9c in tsr9 when cmf9c is set to 1. bit 2: cme9c description 0 cmi9c interrupt requested by cmf9c is disabled (initial value) 1 cmi9c interrupt requested by cmf9c is enabled ? bit 1?ompare-match interrupt enable 9b (cme9b): enables or disables interrupt requests by cmf9b in tsr9 when cmf9b is set to 1. bit 1: cme9b description 0 cmi9b interrupt requested by cmf9b is disabled (initial value) 1 cmi9b interrupt requested by cmf9b is enabled ? bit 0?ompare-match interrupt enable 9a (cme9a): enables or disables interrupt requests by cmf9a in tsr9 when cmf9a is set to 1. bit 0: cme9a description 0 cmi9a interrupt requested by cmf9a is disabled (initial value) 1 cmi9a interrupt requested by cmf9a is enabled
281 timer interrupt enable register 11 (tier11) tier11 controls enabling/disabling of channel 11 compare-match and overflow interrupt requests. bit: 15 14 13 12 11 10 9 8 ??????? ove11 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 ?????? ime11b ime11a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?verflow interrupt enable 11 (ove11): enables or disables interrupt requests by ovf11 in tsr11 when ovf11 is set to 1. bit 8: ove11 description 0 ovi11 interrupt requested by ovf11 is disabled (initial value) 1 ovi11 interrupt requested by ovf11 is enabled ? bits 7 to 2?eserved: these bits always read 0. the write value should always be 0. ? bit 1?ompare-match interrupt enable 11b (ime11b): enables or disables interrupt requests by imf11b in tsr11 when imf11b is set to 1. bit 1: ime11b description 0 imi11b interrupt requested by imf11b is disabled (initial value) 1 imi11b interrupt requested by imf11b is enabled ? bit 0?ompare-match interrupt enable 11a (ime11a): enables or disables interrupt requests by imf11a in tsr11 when imf11a is set to 1. bit 0: ime11a description 0 imi11a interrupt requested by imf11a is disabled (initial value) 1 imi11a interrupt requested by imf11a is enabled
282 10.2.7 interval interrupt request registers (itvrr) the interval interrupt request registers (itvrr) are 8-bit registers. the atu-ii has three itvrr registers in channel 0. channel abbreviation function 0 itvrr1 tcnt0 bit 6 to 9 interval interrupt generation itvrr2a tcnt0 bit 10 to 13 interval interrupt generation and a/d0 converter activation itvrr2b tcnt0 bit 10 to 13 interval interrupt generation and a/d1 converter activation interval interrupt request register 1 (itvrr1) bit: 7 6 5 4 3 2 1 0 ???? itve9 itve8 itve7 itve6 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w itvrr1 is an 8-bit readable/writable register that detects the rise of bits corresponding to the channel 0 free-running counter (tcnt0) and requests cyclic interrupt. itvrr1 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bit 7 to 4?eserved: these bits always read 0. the write value should always be 0. ? bit 3?nterval interrupt bit 9 (itve9): intc interval interrupt setting bit corresponding to bit 9 in tcnt0. the rise of bit 9 in tcnt0 is anded with itve9, the result is stored in iif1 in tsr0, and an interrupt request is sent to the cpu. bit 3: itve9 description 0 interrupt request (itv1) by rise of tcnt0 bit 9 is disabled (initial value) 1 interrupt request (itv1) by rise of tcnt0 bit 9 is enabled ? bit 2?nterval interrupt bit 8 (itve8): intc interval interrupt setting bit corresponding to bit 8 in tcnt0. the rise of bit 8 in tcnt0 is anded with itve8, the result is stored in iif1 in tsr0, and an interrupt request is sent to the cpu.
283 bit 2: itve8 description 0 interrupt request (itv1) by rise of tcnt0 bit 8 is disabled (initial value) 1 interrupt request (itv1) by rise of tcnt0 bit 8 is enabled ? bit 1?nterval interrupt bit 7 (itve7): intc interval interrupt setting bit corresponding to bit 7 in tcnt0. the rise of bit 7 in tcnt0 is anded with itve7, the result is stored in iif1 in tsr0, and an interrupt request is sent to the cpu. bit 1: itve7 description 0 interrupt request (itv1) by rise of tcnt0 bit 7 is disabled (initial value) 1 interrupt request (itv1) by rise of tcnt0 bit 7 is enabled ? bit 0?nterval interrupt bit 6 (itve6): intc interval interrupt setting bit corresponding to bit 6 in tcnt0. the rise of bit 6 in tcnt0 is anded with itve6, the result is stored in iif1 in tsr0, and an interrupt request is sent to the cpu. bit 0: itve6 description 0 interrupt request (itv1) by rise of tcnt0 bit 6 is disabled (initial value) 1 interrupt request (itv1) by rise of tcnt0 bit 6 is enabled interval interrupt request registers 2a and 2b (itvrr2a, itvrr2b) bit: 7 6 5 4 3 2 1 0 itva13x itva12x itva11x itva10x itve13x itve12x itve11x itve10x initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w x = a or b ? bit 7?/d0 / a/d1 converter interval activation bit 13a/13b (itva13a/itva13b): a/d0 or a/d1 (itvrr2a: a/d0; itvrr2b: a/d1) converter activation setting bit corresponding to bit 13 in tcnt0. the rise of bit 13 in tcnt0 is anded with itva13x, and the result is output to the a/d0 or a/d1 converter as an activation signal. bit 7: itva13x description 0 a/d0 or a/d1 converter activation by rise of tcnt0 bit 13 is disabled (initial value) 1 a/d0 or a/d1 converter activation by rise of tcnt0 bit 13 is enabled x = a or b
284 ? bit 6?/d0 / a/d1 converter interval activation bit 12a/12b (itva12a/itva12b): a/d0 or a/d1 (itvrr2a: a/d0; itvrr2b: a/d1) converter activation setting bit corresponding to bit 12 in tcnt0. the rise of bit 12 in tcnt0 is anded with itva12x, and the result is output to the a/d0 or a/d1 converter as an activation signal. bit 6: itva12x description 0 a/d0 or a/d1 converter activation by rise of tcnt0 bit 12 is disabled (initial value) 1 a/d0 or a/d1 converter activation by rise of tcnt0 bit 12 is enabled x = a or b ? bit 5?/d0 / a/d1 converter interval activation bit 11a/11b (itva11a/itva11b): a/d0 or a/d1 (itvrr2a: a/d0; itvrr2b: a/d1) converter activation setting bit corresponding to bit 11 in tcnt0. the rise of bit 11 in tcnt0 is anded with itva11x, and the result is output to the a/d0 or a/d1 converter as an activation signal. bit 5: itva11x description 0 a/d0 or a/d1 converter activation by rise of tcnt0 bit 11 is disabled (initial value) 1 a/d0 or a/d1 converter activation by rise of tcnt0 bit 11 is enabled x = a or b ? bit 4?/d0 / a/d1 converter interval activation bit 10a/10b (itva10a/itva10b): a/d0 or a/d1 (itvrr2a: a/d0; itvrr2b: a/d1) converter activation setting bit corresponding to bit 10 in tcnt0. the rise of bit 10 in tcnt0 is anded with itva10x, and the result is output to the a/d0 or a/d1 converter as an activation signal. bit 4: itva10x description 0 a/d0 or a/d1 converter activation by rise of tcnt0 bit 10 is disabled (initial value) 1 a/d0 or a/d1 converter activation by rise of tcnt0 bit 10 is enabled x = a or b
285 ? bit 3?nterval interrupt bit 13a/13b (itve13a/itve13b): intc interval interrupt setting bit corresponding to bit 13 in tcnt0. the rise of bit 13 in tcnt0 is anded with itve13x, the result is stored in iif2x in tsr0, and an interrupt request is sent to the cpu. bit 3: itve13x description 0 interrupt request (itv2x) by rise of tcnt0 bit 13 is disabled (initial value) 1 interrupt request (itv2x) by rise of tcnt0 bit 13 is enabled x = a or b ? bit 2?nterval interrupt bit 12a/12b (itve12a/itve12b): intc interval interrupt setting bit corresponding to bit 12 in tcnt0. the rise of bit 12 in tcnt0 is anded with itve12x, the result is stored in iif2x in tsr0, and an interrupt request is sent to the cpu. bit 2: itve12x description 0 interrupt request (itv2x) by rise of tcnt0 bit 12 is disabled (initial value) 1 interrupt request (itv2x) by rise of tcnt0 bit 12 is enabled x = a or b ? bit 1?nterval interrupt bit 11a/11b (itve11a/itve11b): intc interval interrupt setting bit corresponding to bit 11 in tcnt0. the rise of bit 11 in tcnt0 is anded with itve11x, the result is stored in iif2x in tsr0, and an interrupt request is sent to the cpu. bit 1: itve11x description 0 interrupt request (itv2x) by rise of tcnt0 bit 11 is disabled (initial value) 1 interrupt request (itv2x) by rise of tcnt0 bit 11 is enabled x = a or b ? bit 0?nterval interrupt bit 10 (itve10): intc interval interrupt setting bit corresponding to bit 10 in tcnt0. the rise of bit 10 in tcnt0 is anded with itve10x, the result is stored in iif2x in tsr0, and an interrupt request is sent to the cpu. bit 0: itve10x description 0 interrupt request (itv2x) by rise of tcnt0 bit 10 is disabled (initial value) 1 interrupt request (itv2x) by rise of tcnt0 bit 10 is enabled x = a or b for details, see section 10.3.7, interval timer functions.
286 10.2.8 trigger mode register (trgmdr) the trigger mode register (trgmdr) is an 8-bit register. the atu-ii has one trgmdr register. bit: 7 6 5 4 3 2 1 0 trgmd ?? ?? ? ?? initial value: 0 0 0 0 0 0 0 0 r/w: r/w r r r r r r r trgmdr is an 8-bit readable/writable register that selects whether a channel 1 compare-match is used as a channel 8 one-shot pulse start trigger or as a one-shot pulse terminate trigger when channel 1 and channel 8 are used in combination. trgmdr is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bit 7?rigger mode selection register (trgmd): selects the channel 8 one-shot pulse start trigger/one-shot pulse terminate trigger setting. bit 7: trgmd description 0 one-shot pulse start trigger (tcnt1b = ocr1) (initial value) one-shot pulse terminate trigger (tcnt1a = gr1a to gr1h) 1 one-shot pulse start trigger (tcnt1a = gr1a to gr1h) one-shot pulse terminate trigger (tcnt1b = ocr1) ? bits 6 to 0?eserved: these bits always read 0. the write value should always be 0. 10.2.9 timer mode register (tmdr) the timer mode register (tmdr) is an 8-bit register. the atu-ii has one tdr register. bit: 7 6 5 4 3 2 1 0 ????? t5pwm t4pwm t3pwm initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r/w r/w r/w tmdr is an 8-bit readable/writable register that specifies whether channels 3 to 5 are used in input capture/output compare mode or pwm mode. tmdr is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode.
287 ? bits 7 to 3?eserved: these bits always read 0. the write value should always be 0. ? bit 2?wm mode 5 (t5pwm): selects whether channel 5 operates in input capture/output compare mode or pwm mode. bit 2: t5pwm description 0 channel 5 operates in input capture/output compare mode (initial value) 1 channel 5 operates in pwm mode when bit t5pwm is set to 1 to select pwm mode, pins tio5a to tio5c become pwm output pins, general register 5d (gr5d) functions as a cycle register, and general registers 5a to 5c (gr5a to gr5c) function as duty registers. settings in the timer i/o control registers (tior5a, tior5b) are invalid, and general registers 5a to 5d (gr5a to gr5d) can be written to. do not use the tio5d pin as a timer output. ? bit 1?wm mode 4 (t4pwm): selects whether channel 4 operates in input capture/output compare mode or pwm mode. bit 1: t4pwm description 0 channel 4 operates in input capture/output compare mode (initial value) 1 channel 4 operates in pwm mode when bit t4pwm is set to 1 to select pwm mode, pins tio4a to tio4c become pwm output pins, general register 4d (gr4d) functions as a cycle register, and general registers 4a to 4c (gr4a to gr4c) function as duty registers. settings in the timer i/o control registers (tior4a, tior4b) are invalid, and general registers 4a to 4d (gr4a to gr4d) can be written to. do not use the tio4d pin as a timer output. ? bit 0?wm mode 3 (t3pwm): selects whether channel 3 operates in input capture/output compare mode or pwm mode. bit 0: t3pwm description 0 channel 3 operates in input capture/output compare mode (initial value) 1 channel 3 operates in pwm mode when bit t3pwm is set to 1 to select pwm mode, pins tio3a to tio3c become pwm output pins, general register 3d (gr3d) functions as a cycle register, and general registers 3a to 3c (gr3a to gr3c) function as duty registers. settings in the timer i/o control registers (tior3a, tior3b) are invalid, and general registers 3a to 3d (gr3a to gr3d) can be written to. do not use the tio3d pin as a timer output.
288 10.2.10 pwm mode register (pmdr) the pwm mode register (pmdr) is an 8-bit register. the atu-ii has one pmdr register. bit: 76543210 dtseld dtselc dtselb dtsela cntseld cntselc cntselb cntsela initial value: 00000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w pmdr is an 8-bit readable/writable register that selects whether channel 6 pwm output is set to on-duty/off-duty, or to non-complementary pwm mode/complementary pwm mode. pmdr is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. ? bit 7?uty selection register d (dtseld): selects whether channel 6d to6d output pwm is set to on-duty or to off-duty. bit 7: dtseld description 0 to6d pwm output is on-duty (initial value) 1 to6d pwm output is off-duty ? bit 6?uty selection register c (dtselc): selects whether channel 6c to6c output pwm is set to on-duty or to off-duty. bit 6: dtselc description 0 to6c pwm output is on-duty (initial value) 1 to6c pwm output is off-duty ? bit 5?uty selection register b (dtselb): selects whether channel 6b to6b output pwm is set to on-duty or to off-duty. bit 5: dtselb description 0 to6b pwm output is on-duty (initial value) 1 to6b pwm output is off-duty
289 ? bit 4?uty selection register a (dtsela): selects whether channel 6a to6a output pwm is set to on-duty or to off-duty. bit 4: dtsela description 0 to6a pwm output is on-duty (initial value) 1 to6a pwm output is off-duty ? bit 3?ounter selection register d (cntseld): selects whether channel 6d pwm is set to non-complementary pwm mode or to complementary pwm mode. bit 3: cntseld description 0 tcnt6d is set to non-complementary pwm mode (initial value) 1 tcnt6d is set to complementary pwm mode ? bit 2?ounter selection register c (cntselc): selects whether channel 6c pwm is set to non-complementary pwm mode or to complementary pwm mode. bit 2: cntselc description 0 tcnt6c is set to non-complementary pwm mode (initial value) 1 tcnt6c is set to complementary pwm mode ? bit 1?ounter selection register b (cntselb): selects whether channel 6b pwm is set to non-complementary pwm mode or to complementary pwm mode. bit 1: cntselb description 0 tcnt6b is set to non-complementary pwm mode (initial value) 1 tcnt6b is set to complementary pwm mode ? bit 0?ounter selection register a (cntsela): selects whether channel 6a pwm is set to non-complementary pwm mode or to complementary pwm mode. bit 0: cntsela description 0 tcnt6a is set to non-complementary pwm mode (initial value) 1 tcnt6a is set to complementary pwm mode
290 10.2.11 down-count start register (dstr) the down-count start register (dstr) is a 16-bit register. the atu-ii has one dstr register in channel 8. bit: 15 14 13 12 11 10 9 8 dst8p dst8o dst8n dst8m dst8l dst8k dst8j dst8i initial value: 0 0 0 0 0 0 0 0 r/w: r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * bit: 7 6 5 4 3 2 1 0 dst8h dst8g dst8f dst8e dst8d dst8c dst8b dst8a initial value: 0 0 0 0 0 0 0 0 r/w: r/w * r/w * r/w * r/w * r/w * r/w * r/w * r/w * note: * only 1 can be written. dstr is a 16-bit readable/writable register that starts the channel 8 down-counter (dcnt). when the one-shot pulse function is used, a value of 1 can be set in a dst8x bit at any time by the user program, except when the corresponding dcnt8x value is h'0000. the dst8x bits are cleared to 0 automatically when the dcnt value overflows. when the offset one-shot pulse function is used, dst8x is automatically set to 1 (except when the dcnt8x value is h'0000) when a compare-match occurs between the channel 1 or 2 free-running counter (tcnt) and a general register (gr) or the output compare register (ocr1) while the corresponding timer connection register (tcnr) bit is set to 1. as regards dst8i to dst8p, if the rlden bit in the reload enable register (rldenr) is set to 1 and the reload register (rldr8) value is not h'0000, a reload is performed into the corresponding dcnt8x, and the dst8x bit is set to 1. dst8x is automatically cleared to 0 when the dcnt8x value underflows, or by input of a channel 1 or 2 one-shot terminate trigger signal set in the trigger mode register (trgmdr) while the corresponding one-shot pulse terminate register (otr) bit is set to 1, whichever occurs first. dcnt8x is cleared to h'0000 when underflow occurs. dstr is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. for details, see sections 10.3.5, one-shot pulse function, and 10.3.6, offset one-shot pulse function and output cutoff function.
291 ? bit 15?own-count start 8p (dst8p): starts down-counter 8p (dcnt8p). bit 15: dst8p description 0 dcnt8p is halted (initial value) [clearing conditions] when the dcnt8p value underflows, or on channel 2 (gr2h) compare- match 1 dcnt8p counts [setting conditions] ? ? ? ? one-shot pulse function: set by user program (dcnt8p h'0000) ? ? ? ? offset one-shot pulse function: set on ocr2h compare-match (dcnt8p h'0000 or reload possible) or by user program (dcnt8p h'0000) ? bit 14?own-count start 8o (dst8o): starts down-counter 8o (dcnt8o). bit 14: dst8o description 0 dcnt8o is halted (initial value) [clearing conditions] when the dcnt8o value underflows, or on channel 2 (gr2g) compare- match 1 dcnt8o counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8o h'0000) ? ? ? ? offset one-shot pulse function: set on ocr2g compare-match (dcnt8o h'0000 or reload possible) or by user program (dcnt8o h'0000) ? bit 13?own-count start 8n (dst8n): starts down-counter 8n (dcnt8n). bit 13: dst8n description 0 dcnt8n is halted (initial value) [clearing conditions] when the dcnt8n value underflows, or on channel 2 (gr2f) compare- match 1 dcnt8n counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8n h'0000) ? ? ? ? offset one-shot pulse function: set on ocr2f compare-match (dcnt8n h'0000 or reload possible) or by user program (dcnt8n h'0000)
292 ? bit 12?own-count start 8m (dst8m): starts down-counter 8m (dcnt8m). bit 12: dst8m description 0 dcnt8m is halted (initial value) [clearing conditions] when the dcnt8m value underflows, or on channel 2 (gr2e) compare- match 1 dcnt8m counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8m h'0000) ? ? ? ? offset one-shot pulse function: set on ocr2e compare-match (dcnt8m h'0000 or reload possible) or by user program (dcnt8m h'0000) ? bit 11?own-count start 8l (dst8l): starts down-counter 8l (dcnt8l). bit 11: dst8l description 0 dcnt8l is halted (initial value) [clearing conditions] when the dcnt8l value underflows, or on channel 2 (gr2d) compare- match 1 dcnt8l counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8l h'0000) ? ? ? ? offset one-shot pulse function: set on ocr2d compare-match (dcnt8l h'0000 or reload possible) or by user program (dcnt8l h'0000) ? bit 10?own-count start 8k (dst8k): starts down-counter 8k (dcnt8k). bit 10: dst8k description 0 dcnt8k is halted (initial value) [clearing conditions] when the dcnt8k value underflows, or on channel 2 (gr2c) compare- match 1 dcnt8k counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8k h'0000) ? ? ? ? offset one-shot pulse function: set on ocr2c compare-match (dcnt8k h'0000 or reload possible) or by user program (dcnt8k h'0000)
293 ? bit 9?own-count start 8j (dst8j): starts down-counter 8j (dcnt8j). bit 9: dst8j description 0 dcnt8j is halted (initial value) [clearing conditions] when the dcnt8j value underflows, or on channel 2 (gr2b) compare- match 1 dcnt8j counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8j h'0000) ? ? ? ? offset one-shot pulse function: set on ocr2b compare-match (dcnt8j h'0000 or reload possible) or by user program (dcnt8j h'0000) ? bit 8?own-count start 8i (dst8i): starts down-counter 8i (dcnt8i). bit 8: dst8i description 0 dcnt8i is halted (initial value) [clearing conditions] when the dcnt8i value underflows, or on channel 2 (gr2a) compare-match 1 dcnt8i counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8i h'0000) ? ? ? ? offset one-shot pulse function: set on ocr2a compare-match (dcnt8i h'0000 or reload possible) or by user program (dcnt8i h'0000) ? bit 7?own-count start 8h (dst8h): starts down-counter 8h (dcnt8h). bit 7: dst8h description 0 dcnt8h is halted (initial value) [clearing conditions] when the dcnt8h value underflows, or on channel 1 (gr1h or ocr1) compare-match 1 dcnt8h counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8h h'0000) ? ? ? ? offset one-shot pulse function: set on ocr1 compare-match or gr1h compare-match, or by user program (dcnt8h h'0000)
294 ? bit 6?own-count start 8g (dst8g): starts down-counter 8g (dcnt8g). bit 6: dst8g description 0 dcnt8g is halted (initial value) [clearing conditions] when the dcnt8g value underflows, or on channel 1 (gr1g or ocr1) compare-match 1 dcnt8g counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8g h'0000) ? ? ? ? offset one-shot pulse function: set on ocr1 compare-match or gr1g compare-match, or by user program (dcnt8g h'0000) ? bit 5?own-count start 8f (dst8f): starts down-counter 8f (dcnt8f). bit 5: dst8f description 0 dcnt8f is halted (initial value) [clearing conditions] when the dcnt8f value underflows, or on channel 1 (gr1f or ocr1) compare-match 1 dcnt8f counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8f h'0000) ? ? ? ? offset one-shot pulse function: set on ocr1 compare-match or gr1f compare-match, or by user program (dcnt8f h'0000) ? bit 4?own-count start 8e (dst8e): starts down-counter 8e (dcnt8e). bit 4: dst8e description 0 dcnt8e is halted (initial value) [clearing conditions] when the dcnt8e value underflows, or on channel 1 (gr1e or ocr1) compare-match 1 dcnt8e counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8e h'0000) ? ? ? ? offset one-shot pulse function: set on ocr1 compare-match or gr1e compare-match, or by user program (dcnt8e h'0000)
295 ? bit 3?own-count start 8d (dst8d): starts down-counter 8d (dcnt8d). bit 3: dst8d description 0 dcnt8d is halted (initial value) [clearing conditions] when the dcnt8d value underflows, or on channel 1 (gr1d or ocr1) compare-match 1 dcnt8d counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8d h'0000) ? ? ? ? offset one-shot pulse function: set on ocr1 compare-match or gr1d compare-match, or by user program (dcnt8d h'0000) ? bit 2?own-count start 8c (dst8c): starts down-counter 8c (dcnt8c). bit 2: dst8c description 0 dcnt8c is halted (initial value) [clearing conditions] when the dcnt8c value underflows, or on channel 1 (gr1c or ocr1) compare-match 1 dcnt8c counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8c h'0000) ? ? ? ? offset one-shot pulse function: set on ocr1 compare-match or gr1c compare-match, or by user program (dcnt8c h'0000) ? bit 1?own-count start 8b (dst8b): starts down-counter 8b (dcnt8b). bit 1: dst8b description 0 dcnt8b is halted (initial value) [clearing conditions] when the dcnt8b value underflows, or on channel 1 (gr1b or ocr1) compare-match 1 dcnt8b counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8b h'0000) ? ? ? ? offset one-shot pulse function: set on ocr1 compare-match or gr1b compare-match, or by user program (dcnt8b h'0000)
296 ? bit 0?own-count start 8a (dst8a): starts down-counter 8a (dcnt8a). bit 0: dst8a description 0 dcnt8a is halted (initial value) [clearing conditions] when the dcnt8a value underflows, or on channel 1 (gr1a or ocr1) compare-match 1 dcnt8a counts [setting conditions] ? one-shot pulse function: set by user program (dcnt8a h'0000) ? ? ? ? offset one-shot pulse function: set on ocr1 compare-match or gr1a compare-match, or by user program (dcnt8a h'0000) 10.2.12 timer connection register (tcnr) the timer connection register (tcnr) is a 16-bit register. the atu-ii has one tcnr register in channel 8. bit: 15 14 13 12 11 10 9 8 cn8p cn8o cn8n cn8m cn8l cn8k cn8j cn8i initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 cn8h cn8g cn8f cn8e cn8d cn8c cn8b cn8a initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w tcnr is a 16-bit readable/writable register that enables or disables connection between the channel 8 down-count start register (dstr) and channel 1 and 2 compare-match signals (down- count start triggers). channel 1 down-count start triggers a to h are channel 1 ocr1 compare- match signals or gr1x compare-match signals (set in trgmdr). channel 2 down-count start triggers a to h are channel 2 ocr2x compare-match signals. when gr1x compare-matches are used, set tior1a to tior1d to allow compare-matches. tcnr is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. for details, see sections 10.3.5, one-shot pulse function, and 10.3.6, offset one-shot pulse function and output cutoff operation.
297 ? bit 15?onnection flag 8p (cn8p): enables or disables connection between dst8p and the channel 2 down-count start trigger. bit 15: cn8p description 0 connection between dst8p and channel 2 down-count start trigger h is disabled (initial value) 1 connection between dst8p and channel 2 down-count start trigger h is enabled ? bit 14?onnection flag 8o (cn8o): enables or disables connection between dst8o and the channel 2 down-count start trigger. bit 14: cn8o description 0 connection between dst8o and channel 2 down-count start trigger g is disabled (initial value) 1 connection between dst8o and channel 2 down-count start trigger g is enabled ? bit 13?onnection flag 8n (cn8n): enables or disables connection between dst8n and the channel 2 down-count start trigger. bit 13: cn8n description 0 connection between dst8n and channel 2 down-count start trigger f is disabled (initial value) 1 connection between dst8n and channel 2 down-count start trigger f is enabled ? bit 12?onnection flag 8m (cn8m): enables or disables connection between dst8m and the channel 2 down-count start trigger. bit 12: cn8m description 0 connection between dst8m and channel 2 down-count start trigger e is disabled (initial value) 1 connection between dst8m and channel 2 down-count start trigger e is enabled
298 ? bit 11?onnection flag 8l (cn8l): enables or disables connection between dst8l and the channel 2 down-count start trigger. bit 11: cn8l description 0 connection between dst8l and channel 2 down-count start trigger d is disabled (initial value) 1 connection between dst8l and channel 2 down-count start trigger d is enabled ? bit 10?onnection flag 8k (cn8k): enables or disables connection between dst8k and the channel 2 down-count start trigger. bit 10: cn8k description 0 connection between dst8k and channel 2 down-count start trigger c is disabled (initial value) 1 connection between dst8k and channel 2 down-count start trigger c is enabled ? bit 9?onnection flag 8j (cn8j): enables or disables connection between dst8j and the channel 2 down-count start trigger. bit 9: cn8j description 0 connection between dst8j and channel 2 down-count start trigger b is disabled (initial value) 1 connection between dst8j and channel 2 down-count start trigger b is enabled ? bit 8?onnection flag 8i (cn8i): enables or disables connection between dst8i and the channel 2 down-count start trigger. bit 8: cn8i description 0 connection between dst8i and channel 2 down-count start trigger a is disabled (initial value) 1 connection between dst8i and channel 2 down-count start trigger a is enabled
299 ? bit 7?onnection flag 8h (cn8h): enables or disables connection between dst8h and the channel 1 down-count start trigger. bit 7: cn8h description 0 connection between dst8h and channel 1 down-count start trigger h is disabled (initial value) 1 connection between dst8h and channel 1 down-count start trigger h is enabled ? bit 6?onnection flag 8g (cn8g): enables or disables connection between dst8g and the channel 1 down-count start trigger. bit 6: cn8g description 0 connection between dst8g and channel 1 down-count start trigger g is disabled (initial value) 1 connection between dst8g and channel 1 down-count start trigger g is enabled ? bit 5?onnection flag 8f (cn8f): enables or disables connection between dst8f and the channel 1 down-count start trigger. bit 5: cn8f description 0 connection between dst8f and channel 1 down-count start trigger f is disabled (initial value) 1 connection between dst8f and channel 1 down-count start trigger f is enabled ? bit 4?onnection flag 8e (cn8e): enables or disables connection between dst8e and the channel 1 down-count start trigger. bit 4: cn8e description 0 connection between dst8e and channel 1 down-count start trigger e is disabled (initial value) 1 connection between dst8e and channel 1 down-count start trigger e is enabled
300 ? bit 3?onnection flag 8d (cn8d): enables or disables connection between dst8d and the channel 1 down-count start trigger. bit 3: cn8d description 0 connection between dst8d and channel 1 down-count start trigger d is disabled (initial value) 1 connection between dst8d and channel 1 down-count start trigger d is enabled ? bit 2?onnection flag 8c (cn8c): enables or disables connection between dst8c and the channel 1 down-count start trigger. bit 2: cn8c description 0 connection between dst8c and channel 1 down-count start trigger c is disabled (initial value) 1 connection between dst8c and channel 1 down-count start trigger c is enabled ? bit 1?onnection flag 8b (cn8b): enables or disables connection between dst8b and the channel 1 down-count start trigger. bit 1: cn8b description 0 connection between dst8b and channel 1 down-count start trigger b is disabled (initial value) 1 connection between dst8b and channel 1 down-count start trigger b is enabled ? bit 0?onnection flag 8a (cn8a): enables or disables connection between dst8a and the channel 1 down-count start trigger. bit 0: cn8a description 0 connection between dst8a and channel 1 down-count start trigger a is disabled (initial value) 1 connection between dst8a and channel 1 down-count start trigger a is enabled
301 10.2.13 one-shot pulse terminate register (otr) the one-shot pulse terminate register (otr) is a 16-bit register. the atu-ii has one otr register in channel 8. bit: 15 14 13 12 11 10 9 8 otep oteo oten otem otel otek otej otei initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 oteh oteg otef otee oted otec oteb otea initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w otr is a 16-bit readable/writable register that enables or disables forced termination of channel 8 one-shot pulse output by channel 1 and 2 compare-match signals. when one-shot pulse output is forcibly terminated, the corresponding dstr bit and down-counter are cleared, and the corresponding tsr8 bit is set. the channel 1 one-shot pulse terminate signal is generated by gr1a to gr1h compare-matches and ocr1 compare-match (see trgmdr). the channel 2 one-shot pulse terminate signal is generated by gr2a to gr2h compare-matches. to generate the terminate signal with gr1a to gr1h and gr2a to gr2h, select the respective compare-matches in tior1a to tior1d. otr is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. ? bit 15?ne-shot pulse terminate enable p (otep): enables or disables forced termination of output by channel 2 down-counter terminate trigger h. bit 15: otep description 0 forced termination of to8p by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8p by down-counter terminate trigger is enabled
302 ? bit 14?ne-shot pulse terminate enable o (oteo): enables or disables forced termination of output by channel 2 down-counter terminate trigger g. bit 14: oteo description 0 forced termination of to8o by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8o by down-counter terminate trigger is enabled ? bit 13?ne-shot pulse terminate enable n (oten): enables or disables forced termination of output by channel 2 down-counter terminate trigger f. bit 13: oten description 0 forced termination of to8n by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8n by down-counter terminate trigger is enabled ? bit 12?ne-shot pulse terminate enable m (otem): enables or disables forced termination of output by channel 2 down-counter terminate trigger e. bit 12: otem description 0 forced termination of to8m by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8m by down-counter terminate trigger is enabled ? bit 11?ne-shot pulse terminate enable l (otel): enables or disables forced termination of output by channel 2 down-counter terminate trigger d. bit 11: otel description 0 forced termination of to8l by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8l by down-counter terminate trigger is enabled ? bit 10?ne-shot pulse terminate enable k (otek): enables or disables forced termination of output by channel 2 down-counter terminate trigger c. bit 10: otek description 0 forced termination of to8k by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8k by down-counter terminate trigger is enabled
303 ? bit 9?ne-shot pulse terminate enable j (otej): enables or disables forced termination of output by channel 2 down-counter terminate trigger b. bit 9: otej description 0 forced termination of to8j by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8j by down-counter terminate trigger is enabled ? bit 8?ne-shot pulse terminate enable i (otei): enables or disables forced termination of output by channel 2 down-counter terminate trigger a. bit 8: otei description 0 forced termination of to8i by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8i by down-counter terminate trigger is enabled ? bit 7?ne-shot pulse terminate enable h (oteh): enables or disables forced termination of output by channel 1 down-counter terminate trigger h. bit 7: oteh description 0 forced termination of to8h by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8h by down-counter terminate trigger is enabled ? bit 6?ne-shot pulse terminate enable g (oteg): enables or disables forced termination of output by channel 1 down-counter terminate trigger g. bit 6: oteg description 0 forced termination of to8g by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8g by down-counter terminate trigger is enabled ? bit 5?ne-shot pulse terminate enable f (otef): enables or disables forced termination of output by channel 1 down-counter terminate trigger f. bit 5: otef description 0 forced termination of to8f by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8f by down-counter terminate trigger is enabled
304 ? bit 4?ne-shot pulse terminate enable e (otee): enables or disables forced termination of output by channel 1 down-counter terminate trigger e. bit 4: otee description 0 forced termination of to8e by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8e by down-counter terminate trigger is enabled ? bit 3?ne-shot pulse terminate enable d (oted): enables or disables forced termination of output by channel 1 down-counter terminate trigger d. bit 3: oted description 0 forced termination of to8d by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8d by down-counter terminate trigger is enabled ? bit 2?ne-shot pulse terminate enable c (otec): enables or disables forced termination of output by channel 1 down-counter terminate trigger c. bit 2: otec description 0 forced termination of to8c by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8c by down-counter terminate trigger is enabled ? bit 1?ne-shot pulse terminate enable b (oteb): enables or disables forced termination of output by channel 1 down-counter terminate trigger b. bit 1: oteb description 0 forced termination of to8b by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8b by down-counter terminate trigger is enabled ? bit 0?ne-shot pulse terminate enable a (otea): enables or disables forced termination of output by channel 1 down-counter terminate trigger a. bit 0: otea description 0 forced termination of to8a by down-counter terminate trigger is disabled (initial value) 1 forced termination of to8a by down-counter terminate trigger is enabled
305 10.2.14 reload enable register (rldenr) the reload enable register (rldenr) is an 8-bit register. the atu-ii has one rldenr register in channel 8. bit: 7 6 5 4 3 2 1 0 rlden ?? ?? ? ?? initial value: 0 0 0 0 0 0 0 0 r/w: r/w r r r r r r r rldenr is an 8-bit readable/writable register that enables or disables loading of the reload register8 (rldr8) value into the down-counters (dcnt8i to dcnt8p). loading is performed on generation of a channel 2 compare-match signal one-shot pulse start trigger. reloading is not performed if there is no linkage with channel 2 (one-shot pulse function), or while the down- counter (dcnt8i to dcnt8p) is running. rldenr is initialized to h'00 by a power-on reset and in hardware standby mode and software standby mode. ? bit 7?eload enable (rlden): enables or disables loading of the rldr value into dcnt8i to dcnt8p. bit 7: rlden description 0 loading of reload register value into down-counters is disabled (initial value) 1 loading of reload register value into down-counters is enabled ? bits 6 to 0?eserved: these bits always read 0. the write value should always be 0.
306 10.2.15 free-running counters (tcnt) the free-running counters (tcnt) are 32- or 16-bit up- or up/down-counters. the atu-ii has 17 tcnt counters: one 32-bit tcnt in channel 0, and sixteen 16-bit tcnts in each of channels 1 to 7 and 11. channel abbreviation function 0 tcnt0h, tcnt0l 32-bit up-counter (initial value h ? 00000000) 1 tcnt1a, tcnt1b 16-bit up-counters (initial value h'0000) 2 tcnt2a, tcnt2b 3 tcnt3 4 tcnt4 5 tcnt5 6 tcnt6a to tcnt6d 16-bit up/down-counters (initial value h'0001) 7 tcnt7a to tcnt7d 16-bit up-counters (initial value h'0001) 11 tcnt11 16-bit up-counter (initial value h'0000) free-running counter 0 (tcnt0h, tcnt0l): free-running counter 0 (comprising tcnt0h and tcnt0l) is a 32-bit readable/writable register that counts on an input clock. when the bits corresponding to the timer start register 1 (tstr1) are set to 1, this counter starts to count. the input clock is selected with prescaler register 1 (pscr1). bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when tcnt0 overflows (from h'ffffffff to h'00000000), the ovf0 overflow flag in the timer status register (tsr0) is set to 1. tcnt0 can only be accessed by a longword read or write. word reads or writes cannot be used. tcnt0 is initialized to h'00000000 by a power-on reset, and in hardware standby mode and software standby mode.
307 free-running counters 1a, 1b, 2a, 2b, 3, 4, 5, 11 (tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3, tcnt4, tcnt5, tcnt11): free-running counters 1a, 1b, 2a, 2b, 3, 4, 5, and 11 (tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3, tcnt4, tcnt5, tcnt11) are 16-bit readable/writable registers that count on an input clock. when the bits corresponding to the timer start register 1, 3 (tstr1, tstr3) are set to 1, these counters start to count. the input clock is selected with prescaler register 1 (pscr1) and the timer control register (tcr). bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit name: initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w the tcnt1a, tcnt1b, tcnt2a, and tcnt2b counters are cleared if incremented during counter clear trigger input from channel 10. tcnt3 to tcnt5 counter clearing is performed by a compare-match with the corresponding general register, according to the setting in tior. when one of counters tcnt1a/1b/2a/2b/3/4/5/11 overflows (from h'ffff to h'0000), the overflow flag (ovf) for the corresponding channel in the timer status register (tsr) is set to 1. tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3, tcnt4, tcnt5, and tcnt11 can only be accessed by a word read or write. tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3, tcnt4, tcnt5, and tcnt11 are initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3, tcnt4, and tcnt5 can count on external clock (tclka or tclkb) input. tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3, tcnt4, and tcnt5 can count on an external interrupt clock (ti10) (agck) generated in channel 10 and on a channel 10 multiplied clock (agckm).
308 free-running counters 6a to 6d and 7a to 7d (tcnt6a to tcnt6d, tcnt7a to tcnt7d): free-running counters 6a to 6d and 7a to 7d (tcnt6a to tcnt6d, tcnt7a to tcnt7d) are 16-bit readable/writable registers. channel 6 and 7 counts are started by the timer start register (tstr2). the clock input to channels 6 and 7 is selected with prescaler registers 2 and 3 (pscr2, pscr3) and timer control registers 6 and 7 (tcr6, tcr7). bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcnt6a to tcnt6d (in non-complementary pwm mode) and tcnt7a to tcnt7d are cleared by a compare-match with the cycle register (cylr). tcnt6a to tcnt6d (in complementary pwm mode) count up and down between zero and the cycle register value. tcnt6a to tcnt6d and tcnt7a to tcnt7d are connected to the cpu by an internal 16-bit bus, and can only be accessed by a word read or write. tcnt6a to tcnt6d and tcnt7a to tcnt7d are initialized to h'0001 by a power-on reset, and in hardware standby mode and software standby mode. 10.2.16 down-counters (dcnt) the dcnt registers are 16-bit down-counters. the atu-ii has 16 dcnt counters in channel 8. channel abbreviation function 8 dcnt8a, dcnt8b, dcnt8c, dcnt8d, dcnt8e, dcnt8f, dcnt8g, dcnt8h, dcnt8i, dcnt8j, dcnt8k, dcnt8l, dcnt8m, dcnt8n, dcnt8o, dcnt8p 16-bit down-counters
309 down-counters 8a to 8p (dcnt8a to dcnt8p): down-counters 8a to 8p (dcnt8a to dcnt8p) are 16-bit readable/writable registers that count on an input clock. the input clock is selected with prescaler register 1 (pscr1) and the timer control register (tcr). bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 bit name: initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when the one-shot pulse function is used, dcnt8x starts counting down when the corresponding dstr bit is set to 1 by the user program after the dcnt8x value has been set. when the dcnt8x value underflows, dstr and dcnt8x are automatically cleared to 0, and the count is stopped. at the same time, the corresponding channel 8 timer status register 8 (tsr8) status flag is set to 1. when the offset one-shot pulse function is used, on compare-match with a channel 1 or 2 general register (gr) or output compare register (ocr) (the compare-match setting being made in the trigger mode register (trgmdr) (for channel 1 only) ) when the corresponding timer connection register (tcnr) bit is 1, the corresponding down-count start register (dstr) bit is automatically set to 1 and the down-count is started. when the dcnt8x value underflows, the corresponding dstr bit and dcnt8x are automatically cleared to 0, the count is stopped, and the output is inverted, or, if a one-shot terminate register (otr) setting has been made to forcibly terminate output by means of a trigger, dstr is cleared to 0 by a channel 1 or 2 compare-match between gr and ocr, the count is forcibly terminated, and the output is inverted. the output is inverted for whichever is first. at the same time, the corresponding channel 8 tsr8 status flag is set to 1. the dcnt8x counters can only be accessed by a word read or write. the dcnt8x counters are initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. for details, see sections 10.3.5, one-shot pulse function, and 10.3.6, offset one-shot pulse function and output cutoff function. 10.2.17 event counters (ecnt) the event counters (ecnt) are 8-bit up-counters. the atu-ii has six ecnt counters in channel 9. channel abbreviation function 9 ecnt9a, ecnt9b, ecnt9c, ecnt9d, ecnt9e, ecnt9f 8-bit event counters
310 the ecnt counters are 8-bit readable/writable registers that count on detection of an input signal from input pins ti9a to ti9f. rising edge, falling edge, or both rising and falling edges can be selected for edge detection. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w when a compare-match with gr9 corresponding to an ecnt9x counter occurs, the compare- match flag (cmf9) in the timer status register (tsr9) is set to 1. when a compare-match with gr occurs, the ecnt9x counter is cleared automatically. the ecnt9x counters can only be accessed by a byte read or write. the ecnt9x counters are initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. 10.2.18 output compare registers (ocr) the output compare registers (ocr) are 16-bit registers. the atu-ii has nine ocr registers: one in channel 1 and eight in channel 2. channel abbreviation function 1 ocr1 output compare registers 2 ocr2a, ocr2b, ocr2c, ocr2d, ocr2e, ocr2f, ocr2g, ocr2h output compare registers 1 and 2a to 2h (ocr1, ocr2a to ocr2h) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w the ocr registers are 16-bit readable/writable registers that have an output compare register function. the ocr and free-running counter (tcnt1b, tcnt2b) values are constantly compared, and if the two values match, the cmf bit in the timer status register (tsr) is set to 1. if channels 1 and 2
311 and channel 8 are linked by the timer connection register (tcnr), the corresponding channel 8 down-counter (dcnt) is started at the same time. the ocr registers can only be accessed by a word read. the ocr registers are initialized to h'ffff by a power-on reset, and in hardware standby mode and software standby mode. 10.2.19 input capture registers (icr) the input capture registers (icr) are 32-bit registers. the atu-ii has four 32-bit icr registers in channel 0. channel abbreviation function 0 icr0ah, icr0al, icr0bh, icr0bl, icr0ch, icr0cl, icr0dh, icr0dl dedicated input capture registers input capture registers 0ah, 0al to 0dh, 0dl (icr0ah, icr0al to icr0dh, icr0dl) bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r r r r r r r r r r r r r r r r bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r r r r r r r r r r r r r r r r the icr registers are 32-bit read-only registers used exclusively for input capture. these dedicated input capture registers store the tcnt0 value on detection of an input capture signal from an external source. the corresponding tsr0 bit is set to 1 at this time. the input capture signal edge to be detected is specified by timer i/o control register tior0. by setting the trg0den bit in tcr10, icr0dh and icr0dl can also be used for input capture in a compare match between tcnt10b and ocr10b. the icr registers can only be accessed by a longword read. word reads cannot be used.
312 the icr registers are initialized to h'00000000 by a power-on reset, and in hardware standby mode and software standby mode. 10.2.20 general registers (gr) the general registers (gr) are 16-bit registers. the atu-ii has 36 general registers: eight each in channels 1 and 2, four each in channels 3 to 5, six in channel 9, and two in channel 11. channel abbreviation function 1 gr1a to gr1h dual-purpose input capture and output compare registers 2 gr2a to gr2h 3 gr3a to gr3d 4 gr4a to gr4d 5 gr5a to gr5d 9 gr9a to gr9f dedicated output compare registers 11 gr11a, gr11b compare match registers general registers 1a to 1h and 2a to 2h (gr1a to gr1h, gr2a to gr2h) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w these gr registers are 16-bit readable/writable registers with both input capture and output compare functions. function switching is performed by means of the timer i/o control registers (tior). when a general register is used for input capture, it stores the tcnt1a or tcnt2a value on detection of an input capture signal from an external source. the corresponding imf bit in tsr is set to 1 at this time. the input capture signal edge to be detected is specified by the corresponding tior. when a general register is used for output compare, the gr value and free-running counter (tcnt1a, tcnt2a) value are constantly compared, and when both values match, the imf bit in the timer status register (tsr) is set to 1. if connection of channels 1 and 2 and channel 8 is specified in the timer connection register (tcnr), the corresponding channel 8 down-counter (dcnt) is started. compare-match output is specified by the corresponding tior. the gr registers can only be accessed by a word read or write.
313 the gr registers are initialized to h'ffff by a power-on reset, and in hardware standby mode and software standby mode. general registers 3a to 3d, 4a to 4d, and 5a to 5d (gr3a to gr3d, gr4a to gr4d, and gr5a to gr5d) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w these gr registers are 16-bit readable/writable registers with both input capture and output compare functions. function switching is performed by means of the timer i/o control registers (tior). when a general register is used for input capture, it stores the corresponding tcnt value on detection of an input capture signal from an external source. the corresponding imf bit in tsr is set to 1 at this time. the input capture signal edge to be detected is specified by the corresponding tior. gr3a to gr3d can also be used for input capture with a channel 9 compare-match as the trigger. in this case, the corresponding imf bit in tsr is not set. when a general register is used for output compare, the gr value and free-running counter (tcnt) value are constantly compared, and when both values match, the imf bit in the timer status register (tsr) is set to 1. compare-match output is specified by the corresponding tior. the gr registers can only be accessed by a word read or write. the gr registers are initialized to h'ffff by a power-on reset, and in hardware standby mode and software standby mode. general registers 9a to 9f (gr9a to gr9f) bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w these gr registers are 8-bit readable/writable registers with a compare-match function. the gr value and event counter (ecnt) value are constantly compared, and when both values match a compare-match signal is generated and the next edge is input, the corresponding cmf bit in tsr is set to 1.
314 in addition, channel 3 (gr3a to gr3d) input capture can be generated by gr9a to gr9d compare-matches. this function is set by trg3xen in the timer control register (tcr). the gr registers can be accessed by a byte read or write. the gr registers are initialized to h'ff by a power-on reset, and in hardware standby mode and software standby mode. general registers 11a, b (gr11a, b) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w these gr registers are 16-bit readable/writable registers with compare-match function. when a general register is used as a compare-match register, the gr value and free-running counter (tcnt) value are constantly compared, and when both values match, the imf bit in the timer status register (tsr) is set to 1. compare-match output is specified by the corresponding tior. gr11a and gr11b compare-mach signals are transmitted to the advanced pulse controller (apc). for details, see section 11, advanced pulse controller (apc). the gr registers can only be accessed by a word read or write. the gr registers are initialized to h'ffff by a power-on reset, and in hardware standby mode and software standby mode. 10.2.21 offset base registers (osbr) the offset base registers (osbr) are 16-bit registers. the atu-ii has two osbr registers, one each in channels 1 and 2. channel abbreviation function 1 osbr1 dedicated input capture registers with signal from channel 0 2 osbr2 icr0a as input trigger
315 offset base registers 1 and 2 (osbr1, osbr2) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r r r r r r r r r r r r r r r r osbr1 and osbr2 are 16-bit read-only registers used exclusively for input capture. osbr1 and osbr2 use the channel 0 icr0a input capture register input as their trigger signal, and store the tcnt1a or tcnt2a value on detection of an edge. the osbr registers can only be accessed by a word read. the osbr registers are initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. for details, see sections 10.3.8, twin-capture function. 10.2.22 cycle registers (cylr) the cycle registers (cylr) are 16-bit registers. the atu-ii has eight cycle registers, four each in channels 6 and 7. channel abbreviation function 6 cylr6a to cylr6d 16-bit pwm cycle registers 7 cylr7a to cylr7d cycle registers (cylr6a to cylr6d, cylr7a to cylr7d) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w the cylr registers are 16-bit readable/writable registers used for pwm cycle storage. the cylr value is constantly compared with the corresponding free-running counter (tcnt6a to tcnt6d, tcnt7a to tcnt7d) value, and when the two values match, the corresponding timer start register (tsr) bit (cmf6a to cmf6d, cmf7a to cmf7d) is set to 1, and the free- running counter (tcnt6a to tcnt6d, tcnt7a to tcnt7d) is cleared. at the same time, the buffer register (bfr) value is transferred to the duty register (dtr).
316 the cylr registers can only be accessed by a word read or write. the cylr registers are initialized to h'ffff by a power-on reset, and in hardware standby mode and software standby mode. for details of the cylr, bfr, and dtr registers, see section 10.3.9, pwm timer function. 10.2.23 buffer registers (bfr) the buffer registers (bfr) are 16-bit registers. the atu-ii has eight buffer registers, four each in channels 6 and 7. channel abbreviation function 6 bfr6a to bfr6d 16-bit pwm buffer registers 7 bfr7a to bfr7d buffer register (bfr) value is transferred to duty register (dtr) on compare-match of corresponding cycle register (cylr) buffer registers (bfr6a to bfr6d, bfr7a to bfr7d) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w the bfr registers are 16-bit readable/writable registers that store the value to be transferred to the duty register (dtr) in the event of a cycle register (cylr) compare-match. the bfr registers can only be accessed by a word read or write. the bfr registers are initialized to h'ffff by a power-on reset, and in hardware standby mode and software standby mode.
317 10.2.24 duty registers (dtr) the duty registers (dtr) are 16-bit registers. the atu-ii has eight duty registers, four each in channels 6 and 7. channel abbreviation function 6 dtr6a to dtr6d 16-bit pwm duty registers 7 dtr7a to dtr7d duty registers (dtr6a to dtr6d, dtr7a to dtr7d) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w the dtr registers are 16-bit readable/writable registers used for pwm duty storage. the dtr value is constantly compared with the corresponding free-running counter (tcnt6a to tcnt6d, tcnt7a to tcnt7d) value, and when the two values match, the corresponding channel output pin (to6a to to6d, to7a to to7d) goes to 0 output. also, when cylr and the corresponding the free-running counter match, the corresponding bfr value is loaded. set a value in the range 0 to cylr for dtr; do not set a value greater than cylr. the dtr registers can only be accessed by a word read or write. the dtr registers are initialized to h'ffff by a power-on reset, and in hardware standby mode and software standby mode.
318 10.2.25 reload register (rldr) the reload register is a 16-bit register. the atu-ii has one rldr register in channel 8. reload register 8 (rldr8) bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w rldr8 is a 16-bit readable/writable register. when reload is enabled (by a setting in rldenr) and dstr8i to dstr8p are set to 1 by the channel 2 compare-match signal one-shot pulse start trigger, the reload register value is transferred to dcnt8i to dcnt8p before the down-count is started. the reload register value is not transferred when the one-shot pulse function is used independently, without linkage to channel 2, or when down-counters dcnt8i to dcnt8p are running. rldr8 can only be accessed by a word read or write. rldr is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. 10.2.26 channel 10 registers counters (tcnt) channel 10 has seven tcnt counters: one 32-bit tcnt, four 16-bit tcnts, and two 8-bit tcnts. the input clock is selected with prescaler register 4 (pscr4). count operations are performed by setting str10 to 1 in timer start register 1 (tstr1). channel abbreviation function 10 tcnt10ah, al 32-bit free-running counter (initial value h'00000001) tcnt10b 8-bit event counter (initial value h'00) tcnt10c 16-bit reload counter (initial value h'0001) tcnt10d 8-bit correction counter (initial value h'00) tcnt10e 16-bit correction counter (initial value h'0000) tcnt10f 16-bit correction counter (initial value h'0001) tcnt10g 16-bit free-running counter (initial value h'0000)
319 free-running counter 10ah, al (tcnt10ah, tcnt10al): free-running counter 10ah, al (comprising tcnt10ah and tcnt10al) is a 32-bit readable/writable register that counts on an input clock and is cleared by input capture input (ti10) (agck). bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcnt10a can only be accessed by a longword read or write. word reads or writes cannot be used. tcnt10a is initialized to h'00000001 by a power-on reset, and in hardware standby mode and software standby mode. event counter 10b (tcnt10b): event counter 10b (tcnt10b) is an 8-bit readable/writable register that counts on external clock input (ti10) (agck). for this operation, ti10 input must be set with bits ckeg1 and ckeg0 in tcr10. ti10 input will be counted even if halting of the count operation is specified by bit str10 in tstr1. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w tcnt10b can only be accessed by a byte read or write. tcnt10b is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode.
320 reload counter 10c (tcnt10c): reload counter 10c (tcnt10c) is a 16-bit readable/writable register. bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w when tcnt10c = h'0001 in the down-count operation, the value in the reload register (rld10c) is transferred to tcnt10c, and a multiplied clock (agck1) is generated. tcnt10c is connected to the cpu via an internal 16-bit bus, and can only be accessed by a word read or write. tcnt10c is initialized to h'0001 by a power-on reset, and in hardware standby mode and software standby mode. correction counter 10d (tcnt10d): correction counter 10d (tcnt10d) is an 8-bit readable/writable register that counts on external clock input (ti10) after transfer of the counter value to correction counter e (tcnt10e). set ti10 input with bits ckeg1 and ckeg0 in tcr10. counting will not be performed on ti10 input unless the count operation is enabled by bit str10 in tstr1. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w at the external clock input (ti10) (agck) timing, the value in this counter is shifted according to the multiplication factor set by bits pim1 and pim0 in timer i/o control register 10 (tior10) and transferred to correction counter e (tcnt10e). tcnt10d can only be accessed by a byte read or write. tcnt10d is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode.
321 correction counter 10e (tcnt10e): correction counter 10e (tcnt10e) is a 16-bit readable/writable register that loads the tcnt10d shift value at the external input (ti10) timing, and counts on the multiplied clock (agck1) output by reload counter 10c (tcnt10c). however, if ccs in timer i/o control register 10 (tior10) is set to 1, when the tcnt10d shifted value is reached the count is halted. bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcnt10e can only be accessed by a word read or write. tcnt10e is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. correction counter 10f (tcnt10f): correction counter 10f (tcnt10f) is a 16-bit readable/writable register that counts up if the counter value is smaller than the correction counter 10e (tcnt10e) value when the str10 bit in tstr1 has been set for counter operation. the count is halted by a match with the correction counter clear register (tcclr10). if ti10 is input when tcnt10d = h'0000, tcnt10f is initialized and correction is carried out. when tcnt10f = tcclr10, tcnt10f is cleared to h'0001. while tcnt10f tcclr10, tcnt10f is incremented automatically until it reaches the tcclr10 value, and is then cleared to h'0001. a corrected clock (agckm) is output following correction each time this counter is incremented. bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcnt10f is can only be accessed by a word read or write. tcnt10f is initialized to h'0001 by a power-on reset, and in hardware standby mode and software standby mode.
322 free-running counter 10g (tcnt10g): free-running counter 10g (tcnt10g) is a 16-bit readable/writable register that counts up on the multiplied clock (agck1). tcnt10g is initialized to h'0000 by input from external input (ti10) (agck). bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcnt10g can only be accessed by a word read or write. tcnt10g is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. registers there are six registers in channel 10: a 32-bit icr, 32-bit ocr, 16-bit gr, 16-bit rld, 16-bit tcclr, and 8-bit ocr. channel abbreviation function 10 icr10ah, al 32-bit input capture register (initial value h'00000000) ocr10ah, al 32-bit output compare register (initial value h'ffffffff) ocr10b 8-bit output compare register (initial value h'ff) rld10c 16-bit reload register (initial value h'0000) gr10g 16-bit general register (initial value h'ffff) tcclr10 16-bit correction counter clear register (initial value h'0000)
323 input capture register 10ah, al (icr10ah, icr10al): input capture register 10ah, al (comprising icr10ah and icr10al) is a 32-bit read-only register to which the tcnt10ah, al value is transferred on external input (ti10) (agck). at the same time, icf10a in timer status register 10 (tcr10) is set to 1. bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r r r r r r r r r r r r r r r r bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r r r r r r r r r r r r r r r r icr10a is initialized to h'00000000 by a power-on reset, and in hardware standby mode and software standby mode. output compare register 10ah, al (ocr10ah, ocr10al): output compare register 10ah, al (comprising ocr10ah and ocr10al) is a 32-bit readable/writable register that is constantly compared with free-running counter 10ah, al (tcnt10ah, tcnt10al). when both values match, cmf10a in timer status register 10 (tsr10) is set to 1. bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w ocr10a is initialized to h'ffffffff by a power-on reset, and in hardware standby mode and software standby mode.
324 output compare register 10b (ocr10b): output compare register 10b (ocr10b) is an 8-bit readable/writable register that is constantly compared with free-running counter 10b (tcnt10b). when agck is input with both values matching, cmf10b in timer status register 10 (tsr10) is set to 1. bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ocr10b is initialized to h'ff by a power-on reset, and in hardware standby mode and software standby mode. reload register 10c (rld10c): reload register 10c (rld10c) is a 16-bit readable/writable register. when str10 in timer start register 1 (tstr1) is 1 and rlden in the timer i/o control register (tior10) is 0, and the value of tcnt10a is captured into input capture register 10a (icr10a), the icr10a capture value is shifted according to the multiplication factor set by bits pim1 and pim0 in tior10 before being transferred to rld10c. the contents of reload register 10c (rld10c) are loaded when reload counter 10c (tcnt10c) reaches h'0001. bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w rld10c is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. general register 10g (gr10g): general register 10g (gr10g) is a 16-bit readable/writable register with an output compare function. function switching is performed by means of timer i/o control register 10 (tior10). the gr10g value and free-running counter 10g (tcnt10g) value are constantly compared, and when agck is input with both values matching, cmf10g in timer status register 10 (tsr10) is set to 1. bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w gr10g is initialized to h'ffff by a power-on reset, and in hardware standby mode and software standby mode.
325 correction counter clear register 10 (tcclr10): correction counter clear register 10 (tcclr10) is a 16-bit readable/writable register. tcclr10 is constantly compared with tcnt10f, and when the two values match, tcnt10f halts. tcntxx can be cleared at this time by setting trgxxen (xx = 1a, 1b, 2a, 2b) in tcr10. then, when tcnt10d is h'0000 and ti10 is input, tcnt10f is cleared to h'0001. bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w tcclr10 is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. noise canceler registers there are two 8-bit noise canceler registers in channel 10: tcnt10h and ncr10. channel abbreviation function 10 tcnt10h noise canceler counter (initial value h'00) ncr10 noise canceler compare-match register (initial value h'ff) noise canceler counter 10h (tcnt10h): noise canceler counter 10h (tcnt10h) is an 8-bit readable/writable register. when the noise canceler function is enabled, tcnt10h starts counting up on p 10, with the signal from external input (ti10) (agck) as a trigger. the counter operates even if str10 is cleared to 0 in the timer start register (tstr1). ti10 input is masked while the counter is running. when the count matches the noise canceler register (ncr10) value, the counter is cleared and ti10 input masking is released. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w tcnt10h is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode.
326 noise canceler register 10 (ncr10): noise canceler register 10 (ncr10) is an 8-bit readable/writable register used to set the upper count limit of noise canceler counter 10h (tcnt10h). tcnt10h is constantly compared with ncr10 during the count, and when a compare-match occurs the tcnt10h counter is halted and input signal masking is released. bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ncr10 is initialized to h'ff by a power-on reset, and in hardware standby mode and software standby mode. channel 10 control registers there are four control registers in channel 10. channel abbreviation function 10 tior10 reload setting, counter correction setting, external input (ti10) edge interval multiplier setting gr compare-match setting (initial value h'00) tcr10 tcclr10 counter clear source noise canceler function enabling/disabling selection external input (ti10) edge selection (initial value h'00) tsr10 input capture/compare-match status (initial value h'0000) tier10 input capture/compare-match interrupt request enabling/disabling selection (initial value h'0000)
327 timer i/o control register 10 (tior10): tior10 is an 8-bit readable/writable register that selects the value for multiplication of the external input (ti10) edge interval. it also makes a setting for using the general register (gr10g) for output compare, and makes the edge detection setting. tior10 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. bit: 7 6 5 4 3 2 1 0 rlden ccs pim1 pim0 ? io10g2 io10g1 io10g0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w ? r/w r/w r/w ? bit 7?eload enable (rlden): enables or disables transfer of the input capture register 10a (icr10a) value to reload register 10c (rld10c). bit 7: rlden description 0 transfer of icr10a value to rld10c on input capture is enabled (initial value) 1 transfer of icr10a value to rld10c on input capture is disabled ? bit 6?ounter clock select (ccs): selects the operation of correction counter 10e (tcnt10e). set the multiplication factor with bits pim1 and pim0. bit 6: ccs description 0 tcnt10e count is not halted when tcnt10d x multiplication factor = tcnt10e * (initial value) 1 tcnt10e count is halted when tcnt10d x multiplication factor = tcnt10e * note: * when [tcnt10d multiplication factor] matches the value of tcnt10e with bits 8 to 0 masked. ? bits 5 and 4?ulse interval multiplier (pim1, pim0): these bits select the external input (ti10) cycle multiplier. bit 5: pim1 bit 4: pim0 description 0 0 counting on external input cycle 32 (initial value) 1 counting on external input cycle 64 1 0 counting on external input cycle 128 1 counting on external input cycle 256
328 ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bits 2 to 0?/o control 10g2 to 10g0 (io10g2 to io10g0): these bits select the function of general register 10g (gr10g). bit 2: io10g2 bit 1: io10g1 bit 0: io10g0 description 0 0 0 gr is an output compare register compare-match disabled (initial value) 1 gr10g = tcnt10g compare-match 1 * cannot be used 1 ** cannot be used timer control register 10 (tcr10): tcr10 is an 8-bit readable/writable register that selects the correction counter clear register (tcclr10) compare-match counter clear source, enables or disables the noise canceler function, and selects the external input (ti10) edge. tcr10 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. bit: 7 6 5 43210 trg2ben trg1ben trg2aen trg1aen trg0den nce ckeg1 ckeg0 initial value: 0 0 0 00000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bit 7?rigger 2b enable (trg2ben): enables or disables counter clearing for channel 2 tcnt2b. if tcnt2b counts while clearing is enabled, tcnt2b will be cleared. bit 7: trg2ben description 0 channel 2 counter b (tcnt2b) clearing when correction counter clear register (tcclr10) = correction counter (tcnt10f) is disabled (initial value) 1 channel 2 counter b (tcnt2b) clearing when correction counter clear register (tcclr10) = correction counter (tcnt10f) is enabled
329 ? bit 6?rigger 1b enable (trg1ben): enables or disables counter clearing for channel 1 tcnt1b. if tcnt1b counts while clearing is enabled, tcnt1b will be cleared. bit 6: trg1ben description 0 channel 1 counter b (tcnt1b) clearing when correction counter clear register (tcclr10) = correction counter (tcnt10f) is disabled (initial value) 1 channel 1 counter b (tcnt1b) clearing when correction counter clear register (tcclr10) = correction counter (tcnt10f) is enabled ? bit 5?rigger 2a enable (trg2aen): enables or disables counter clearing for channel 2 tcnt2a. if tcnt2a counts while clearing is enabled, tcnt2a will be cleared. bit 5: trg2aen description 0 channel 2 counter 2a (tcnt2a) clearing when correction counter clear register (tcclr10) = correction counter (tcnt10f) is disabled (initial value) 1 channel 2 counter 2a (tcnt2a) clearing when correction counter clear register (tcclr10) = correction counter (tcnt10f) is enabled ? bit 4?rigger 1a enable (trg1aen): enables or disables counter clearing for channel 1 tcnt1a. if tcnt1a counts while clearing is enabled, tcnt1a will be cleared. bit 4: trg1aen description 0 channel 1 counter 1a (tcnt1a) clearing when correction counter clear register (tcclr10) = correction counter (tcnt10f) is disabled (initial value) 1 channel 1 counter 1a (tcnt1a) clearing when correction counter clear register (tcclr10) = correction counter (tcnt10f) is enabled ? bit 3?rigger 0d enable (trg0den): enables or disables channel 0 icr0d input capture signal requests. bit 3: trg0den description 0 capture requests for channel 0 input capture register (icr0d) on event counter (tcnt10b) compare-match are disabled (initial value) 1 capture requests for channel 0 input capture register (icr0d) on event counter (tcnt10b) compare-match are enabled
330 ? bit 2?oise canceler enable (nce): enables or disables the noise canceler function. bit 2: nce description 0 noise canceler function is disabled (initial value) 1 noise canceler function is enabled ? bits 1 and 0?lock edge 1 and 0 (ckeg1, ckeg0): these bits select the channel 10 external input (ti10) edge(s). the clock (agck) is generated by the detected edge(s). bit 1: ckeg1 bit 0: ckeg0 description 0 0 ti10 input disabled (initial value) 1 ti10 input rising edges detected 1 0 ti10 input falling edges detected 1 ti10 input rising and falling edges both detected timer status register 10 (tsr10): tsr10 is a 16-bit readable/writable register that indicates the occurrence of channel 10 input capture or compare-match. each flag is an interrupt source, and issues an interrupt request to the cpu if the interrupt is enabled by the corresponding bit in timer interrupt enable register 10 (tier10). tsr10 is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ???? cmf10g cmf10b icf10a cmf10a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/(w) * r/(w) * r/(w) * r/(w) * note: * only 0 can be written, to clear the flag. ? bits 15 to 4?eserved: these bits always read 0. the write value should always be 0.
331 ? bit 3?ompare-match flag 10g (cmf10g): status flag that indicates gr10g compare- match. bit 3: cmf10g description 0 [clearing condition] (initial value) when cmf10g is read while set to 1, then 0 is written to imf10g 1 [setting condition] when tcnt10g = gr10g ? bit 2?ompare-match flag 10b (cmf10b): status flag that indicates ocr10b compare- match. bit 2: cmf10b description 0 [clearing condition] (initial value) when cmf10b is read while set to 1, then 0 is written to cmf10b 1 [setting condition] when tcnt10b is incremented while tcnt10b = ocr10b ? bit 1?nput capture flag 10a (icf10a): status flag that indicates icr10a input capture. bit 1: icf10a description 0 [clearing condition] (initial value) when icr10a is read while set to 1, then 0 is written to icr10a 1 [setting condition] when the tcnt10a value is transferred to icr10a by an input capture signal ? bit 0?ompare-match flag 10a (cmf10a): status flag that indicates ocr10a compare- match. bit 0: cmf10a description 0 [clearing condition] (initial value) when cmf10a is read while set to 1, then 0 is written to cmf10a 1 [setting condition] when tcnt10a = ocr10a
332 timer interrupt enable register 10 (tier10): tier10 is a 16-bit readable/writable register that controls enabling/disabling of channel 10 input capture and compare-match interrupt requests. tier10 is initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ??? ireg cme10g cme10b ice10a cme10a initial value: 0 0 0 0 0 0 0 0 r/w: r r r r/w r/w r/w r/w r/w ? bits 15 to 5?eserved: these bits always read 0. the write value should always be 0. ? bit 4?nterrupt enable edge g (ireg): specifies tsr10 cmf10g interrupt request timing. bit 4: ireg description 0 interrupt is requested when cmf10g becomes 1 (initial value) 1 interrupt is requested by next external input (ti10) (agck) after cmf10g becomes 1 ? bit 3?ompare-match interrupt enable 10g (cme10g): enables or disables interrupt requests by cmf10g in tsr10 when cmf10g is set to 1. bit 3: cme10g description 0 cmi10g interrupt requested by cmf10g is disabled (initial value) 1 cmi10g interrupt requested by cmf10g is enabled ? bit 2?ompare-match interrupt enable 10b (cme10b): enables or disables interrupt requests by cmf10b in tsr10 when cmf10b is set to 1. bit 2: cme10b description 0 cmi10b interrupt requested by cmf10b is disabled (initial value) 1 cmi10b interrupt requested by cmf10b is enabled
333 ? bit 1?nput capture interrupt enable 10a (ice10a): enables or disables interrupt requests by icf10a in tsr10 when icf10a is set to 1. bit 1: ice10a description 0 ici10a interrupt requested by icf10a is disabled (initial value) 1 ici10a interrupt requested by icf10a is enabled ? bit 0?ompare-match interrupt enable 10a (cme10a): enables or disables interrupt requests by cmf10a in tsr10 when cmf10a is set to 1. bit 0: cme10a description 0 cmi10a interrupt requested by cmf10a is disabled (initial value) 1 cmi10a interrupt requested by cmf10a is enabled 10.3 operation 10.3.1 overview the atu-ii has twelve timers of eight kinds in channels 0 to 11. it also has a built-in prescaler that generates input clocks, and it is possible to generate or select internal clocks of the required frequency independently of circuitry outside the atu-ii. the operation of each channel and the prescaler is outlined below. channel 0: channel 0 has a 32-bit free-running counter (tcnt0) and four 32-bit input capture registers (icr0a to icr0d). tcnt0 is an up-counter that performs free-running operation. an interrupt request can be generated on counter overflow. the four input capture registers (icr0a to icr0d) capture the free-running counter (tcnt0) value by means of input from the corresponding external signal input pin (ti0a to ti0d). for capture by means of input from an external signal input pin, rising edge, falling edge, or both edges can be selected in the timer i/o control register (tior0). in the case of input capture register 0d (icr0d) only, capture can be performed by means of a compare-match between free-running counter 10b (tcnt10b) and compare-match register 10b (ocr10b), by making a setting in timer control register 10 (tcr10). in this case, capture is performed even if an input capture disable setting has been made for tior0. in each case, the dmac can be activated or an interrupt requested when capture occurs. channel 0 also has three interval interrupt request registers (itvrr1, itvrr2a, itvrr2b). a/d converter (ad0 to ad2) activation can be selected by setting 1 in itva6 to itva13 in itvrr, and an interrupt request to the cpu by setting 1 in itve6 to itve13. these operations are performed when the corresponding bit of bits 6 to 13 in tcnt0 changes to 1, enabling use as an interval timer function.
334 channel 1: channel 1 has two 16-bit free-running counters (tcnt1a, tcnt1b), eight 16-bit general registers (gr1a to gr1h), and a 16-bit output compare register (ocr1). tcnt1a and tcnt1b are up-counters that perform free-running operation. when the clock generated in channel 10 (described below) is selected, these counters can be cleared at the count specified in channel 10. each counter can generate an interrupt request when it overflows. the eight general registers (gr1a to gr1h) can be used as input capture or output compare registers using the corresponding external signal i/o pin (tio1a to tio1h). when used for input capture, the free-running counter (tcnt1a) value is captured by means of input from the corresponding external signal i/o pin (tio1a to tio1h). rising edge, falling edge, or both edges can be selected for the input capture signal in the timer i/o control registers (tior1a to tior1d). when used for output compare, compare-match with the free-running counter (tcnt1a) is performed. for the output from the external signal i/o pins by compare-match, 0 output, 1 output, or toggle output can be selected in the timer i/o control registers (tior1a to tior1d). when used as output compare registers, a compare-match can be used as a one-shot pulse start/terminate trigger by setting the channel 8 timer connection register (tcnr) and one- shot pulse terminate register (otr), and using these in combination with the down-counters (dcnt8a to dcnt8h). start/terminate trigger selection is performed by means of the trigger mode register (trgmdr). the output compare register (ocr1) can be used as a one-shot pulse offset function, in the same way as the general registers, in combination with channel 8 down-counters dcnt8a to dcnt8h. an interrupt can be requested on the occurrence of the respective input capture or compare-match. in addition, channel 1 has a 16-bit dedicated input capture register (osbr1). the channel 0 ti0a input pin can also be used as the osbr1 trigger input, enabling use of a twin-capture function. channel 2: channel 2 has two 16-bit free-running counters (tcnt2a, tcnt2b), eight 16-bit general registers (gr2a to gr2h), and eight 16-bit output compare registers (ocr2a to ocr2h). tcnt2a and tcnt2b are up-counters that perform free-running operation. when the clock generated in channel 10 (described below) is selected, these counters can be cleared at the count specified in channel 10. each counter can generate an interrupt request when it overflows. the eight general registers (gr2a to gr2h) can be used as input capture or output compare registers using the corresponding external signal i/o pin (tio2a to tio2h). when used for input capture, the free-running counter (tcnt2a) value is captured by means of input from the corresponding external signal i/o pin (tio2a to tio2h). rising edge, falling edge, or both edges can be selected for the input capture signal in the timer i/o control registers (tior2a to tior2d). when used for output compare, compare-match with the free-running counter (tcnt2a) is performed. for the output from the external signal i/o pins by compare-match, 0 output, 1 output, or toggle output can be selected in the timer i/o control registers (tior2a to
335 tior2d). when used as output compare registers, a compare-match can be used as a one-shot pulse terminate trigger by setting the channel 8 one-shot pulse terminate register (otr), and using this in combination with the down-counters (dcnt8a to dcnt8h). in the case of the output compare registers (ocr2a to ocr2h), a tcnt2b compare-match can be used as a one-shot pulse start trigger by setting the channel 8 timer connection register (tcnr), and using this in combination with the down-counters (dcnt8i to dcnt8p). an interrupt can be requested on the occurrence of the respective input capture or compare-match. in addition, channel 2 has a 16-bit dedicated input capture register (osbr2). the channel 0 ti0a input pin can also be used as the osbr2 trigger input, enabling use of a twin-capture function. channels 3 to 5: channels 3 to 5 each have a 16-bit free-running counter (tcnt3 to tcnt5) and four 16-bit general registers (gr3a to gr3d, gr4a to gr4d, gr5a to gr5d). tcnt3 to tcnt5 are up-counters that perform free-running operation. channels 3 to 5 each have a 16-bit free-running counter (tcnt3 to tcnt5) and four 16-bit general registers (gr3a to gr3d, gr4a to gr4d, gr5a to gr5d). tcnt3 to tcnt5 are up-counters that perform free-running operation. in addition, counter clearing can be performed by compare-match by making a setting in the timer i/o control register (tior3a, tior3b, tior4a, tior4b, tior5a, tior5b). each counter can generate an interrupt request when it overflows. the four general registers (gr3a to gr3d, gr4a to gr4d, gr5a to gr5d) each have corresponding external signal i/o pins (tio3a to tio3d, tio4a to tio4d, tio5a to tio5d), and can be used as input capture or output compare registers. when used for input capture, the free-running counter (tcnt3 to tcnt5) value is captured by means of input from the corresponding external signal i/o pin (tio3a to tio3d, tio4a to tio4d, tio5a to tio5d). rising edge, falling edge, or both edges can be selected for the input capture signal in the timer i/o control registers (tior3a, tior3b, tior4a, tior4b, tior5a, tior5b). also, in use for input capture, input capture can be performed using a compare-match between a channel 9 event counter (ecnt9a to ecnt9d), described later, and a general register (gr9a to gr9d) as the trigger. in this case, capture is performed even if an input capture disable setting has been made for tior3a to tior3d. when used for output compare, compare-match with the free-running counter (tcnt3 to tcnt5) is performed. for the output from the external signal i/o pins by compare-match, 0 output, 1 output, or toggle output can be selected in the timer i/o control registers (tior3a, tior3b, tior4a, tior4b, tior5a, tior5b). an interrupt can be requested on the occurrence of the respective input capture or compare-match. however, in the case of input capture using channel 9 as a trigger, an interrupt request from channel 3 cannot be used. by selecting pwm mode in the timer mode register (tmdr), pwm output can be obtained, with three outputs for each. in this case, gr3d, gr4d, and gr5d are automatically used as cycle registers, and gr3a to gr3c, gr4a to gr4c, gr5a to gr5c, as duty registers. tcnt3 to tcnt5 are cleared by the corresponding gr3d, gr4d, or gr5d compare-match.
336 channels 6 and 7: channels 6 and 7 each have 16-bit free-running counters (tcnt6a to tcnt6d, tcnt7a to tcnt7d), 16-bit cycle registers (cylr6a to cylr6d, cylr7a to cylr7d), 16-bit duty registers (dtr6a to dtr6d, dtr7a to dtr7d), and buffer registers (bfr6a to bfr6d, bfr7a to bfr7d). channels 6 and 7 also each have external output pins (to6a to to6d, to7a to to7d), and can be used as buffered pwm timers. the tcnt registers are up-counters, and 0 is output to the corresponding external output pin when the tcnt value matches the dtr value (when dtr cylr). when the tcnt value matches the cylr value (when dtr h'0000), 1 is output to the external output pin, tcnt is initialized to h'0001, and the bfr value is transferred to dtr. thus, the configuration of channels 6 and 7 enables them to perform waveform output with the cylr value as the cycle and the dtr value as the duty, and to use bfr to absorb the time lag between setting of data in dtr and compare-match occurrence. when dtr = cylr, 1 is output continuously to the external output pin, giving a duty of 100%. when dtr = h'0000, 0 is output continuously to the external output pin, giving a duty of 0%. do not set a value in dtr that will result in the condition dtr > cylr. in channel 6, tcnt can also be designated for complementary pwm output by means of the pwm mode register (pmdr). when the corresponding tstr is set to 1, tcnt starts counting up, then switches to a down-count when the count matches the cylr value. when tcnt reaches h'0000, it starts counting up again. when tcnt = dtr, the corresponding to6a to to6d output changes. whether tcnt is counting up or down can be ascertained from the timer status register (tsr6). dmac activation and interrupt request generation, respectively, are possible when tcnt = cylr in asynchronous pwm mode, and when tcnt = h'0000 in complementary pwm mode. channel 8: channel 8 has sixteen 16-bit down-counters (dcnt8a to dcnt8p). the down- counters have corresponding external signal output pins, and can generate one-shot pulses. setting a value in dcnt and setting the corresponding bit to 1 in the down-count start register (dstr) starts dcnt operation and simultaneously outputs 1 to the external output pin. when dcnt counts down to h'0000, it stops and outputs 0 to the external output pin. an interrupt can be requested when dcnt underflows. down-counter operation can be coupled with the channel 1 or channel 2 output compare function by means of settings in the timer connection register (tcnr) and one-shot pulse terminate register (otr), respectively, so that dcnt8i to dcnt8h count operations are started and stopped from channel 1, and dcnt8i to dcnt8p count operations from channel 2. dcnt8i to dcnt8p have a reload register (rldr), and a setting in the reload enable register (rlden) enables count operations to be started after reading the value from this register. channel 9: channel 9 has six 8-bit event counters (ecnt9a to ecnt9f) and six 8-bit general registers (gr9a to gr9f). the event counters are up-counters, each with a corresponding external input pin (ecnt9a to ecnt9f). the event counter value is incremented by input from
337 the corresponding external input pin. incrementing on the rising edge, falling edge, or both edges can be selected by means of settings in the timer control registers (tcr9a to tcr9c). an event counter is cleared by edge input after a match with the corresponding general register. an interrupt can requested when an event counter is cleared. timer control register (tcr9a, tcr9b) settings can be made to enable event counters ecnt9a to ecnt9d to send a compare-match signal to channel 3 when the count matches the corresponding general register (gr9a to gr9d), allowing input capture to be performed on channel 3. this enables the pulse input interval to be measured. channel 10: channel 10 generates a multiplied clock based on external input, and supplies this to channels 1 to 5. channel 10 is divided into three blocks: (1) an inter-edge measurement block, (2) a multiplied clock generation block, and (3) a multiplied clock correction block. (1) inter-edge measurement block this block has a 32-bit free-running counter (tcnt10a), 32-bit input capture register (icr10a), 32-bit output compare register (ocr10a), 8-bit event counter (tcnt10b), 8-bit output compare register (ocr10b), 8-bit noise canceler counter (tcnt10h), and 8-bit noise canceler compare-match register (ncr10). the 32-bit free-running counter (tcnt10a) is an up-counter that performs free-running operations. when input capture is performed by means of ti10 input, this counter is cleared to h'00000001. when free-running counter (tcnt10a) reaches the value set in the output compare register (ocr10a), a compare-match interrupt can be requested. the input capture register (icr10a) has an external signal input pin (ti10), and the free- running counter (tcnt10a) value can be captured by means of input from ti10. rising edge, falling edge, or both edges can be selected by making a setting in bits ckeg1 and ckeg0 in the timer control register (tcr10). the ti10 input has a noise canceler function, which can be enabled by setting the nce bit in the timer control register (tcr10). when the counter value is captured, tcnt10a is cleared to 0 and an interrupt can be requested. the captured value can be transferred to the multiplied clock generation block reload register (rld10c). the 8-bit event counter (tcnt10b) is an up-counter that is incremented by ti10 input. when the event counter (tcnt10b) value reaches the value set in the output compare register (ocr10b), a compare-match interrupt can be requested. by setting the trg0den bit in the timer control register (tcr10), a capture request can also be issued for the channel 0 input capture register 0d (icr0d) when compare-match occurs. the 8-bit noise canceler counter (tcnt10h) and 8-bit noise canceler compare-match register (ncr10) are used to set the period for which the noise canceler functions. by setting a value in the noise canceler compare-match register (tcnt10h) and setting the nce bit in the timer control register (tcr10), ti10 input is masked when it occurs. at the same time as ti10 input is masked, the noise canceler counter (tcnt10h) starts counting up on the p x10 clock.
338 when the noise canceler counter (tcnt10h) value matches the noise canceler compare-match register (ncr10) value, the noise canceler counter (tcnt10h) is cleared to h'0000 and ti10 input masking is cleared. (2) multiplied clock generation block this block has 16-bit reload counters (tcnt10c, rld10c), a 16-bit register free-running counter (tcnt10g), and a 16-bit general register (gr10g). 16-bit reload counter 10c (rld10c) is captured by 32-bit input capture register 10a (icr10a), and when rlden in the timer i/o control register (tior10) is 0, the value captured in input capture register 10a is transferred to the multiplied clock generation block reload register (rld10c). the value transferred can be selected from 1/32, 1/64, 1/128, or 1/256 the original value, according to the setting of bits pim1 and pim0 in tior10. 16-bit reload counter 10c (tcnt10c) performs down-count operations. when tcnt10c reaches h'0001, the value is read automatically from the reload buffer (rld10c), internal clock agck1 is generated, and the down-count operation is repeated. internally generated agck1 is input as a clock to the multiplied clock correction block 16-bit correction counter (tcnt10e) and 16-bit free-running counter 10g (tcnt10g). 16-bit register free-running counter 10g (tcnt10g) counts on agck1 generated by tcnt10c. it is initialized to h'0000 by external input from ti10. the 16-bit general register (gr10g) can be used in a compare-match with free-running counter 10g (tcnt10g) by setting bits io10g2 to io10g0 in the timer i/o control register (tior10). an interrupt can be requested when a compare-match occurs. also, by setting timer interrupt enable register 10 (tier10), an interrupt can be request in the event of ti10 input after a compare-match. (3) multiplied clock correction block this block has three 16-bit correction counters (tcnt10d, tcnt10e, tcnt10f) and a 16- bit correction counter clear register (tcclr10). when 32-bit input capture register 10a (icr10a) performs a capture operation due to input from external input pin ti10, the value in correction counter 10d (tcnt10d) is transferred to tcnt10e and tcnt10d is incremented. the value transferred to tcnt10e is 32, 64, 128, or 256 times the tcnt10d value, according to the setting of bits pim1 and pim0 in the timer i/o control register (tior10). 16-bit correction counter 10e (tcnt10e) counts up on agck1 generated by reload counter 10c (tcnt10c, rld10c) in the multiplied clock generation block. however, by setting the ccs bit in the timer i/o control register (tior10), it is possible to stop free-running counter 10e (tcnt10e) when the free-running counter 10d (tcnt10d) multiplication value specified by pim1 and pim0 and the free-running counter 10e (tcnt10e) value match. the multiplied tcnt10d value is transferred when input capture register 10a (icr10a) performs a capture operation due to ti10 input.
339 16-bit correction counter 10f (tcnt10f) has p as its input and is constantly compared with 16-bit correction counter 10e (tcnt10e). when the 16-bit correction counter 10f (tcnt10f) value is smaller than that in 16-bit correction counter 10e (tcnt10e), it is incremented and generates count-up agckm. when the 16-bit correction counter 10f (tcnt10f) value exceeds that in 16-bit correction counter 10e (tcnt10e) (for example, when tcnt10f reloads tcnt10d), no count-up operation is performed. the ti10 multiplied signal (agckm) generated when tcnt10f is incremented is output to the channel 1 to 5 free-running counters (tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3, tcnt4, tcnt5), and an up-count can be performed on agckm by setting this as the counter clock on each channel. tcnt10f is constantly compared with the 16-bit correction counter clear register (tcclr10), and when the free-running counter 10f (tcnt10f) and correction counter clear register (tcclr10) values match, the tcnt10f up-count stops. setting trg1aen, trg1ben, trg2aen, and trg2ben in the timer control register (tcr10) enables the channel 1 and 2 free-running counters (tcnt1a, tcnt1b, tcnt2a, tcnt2b) to be cleared at this time. if ti10 is input when tcnt10d = h'0000, initialization and correction operations are performed. when tcnt10f = tcclr10, tcnt10f is cleared to h'0001. when tcnt10f tcclr10, tcnt10f automatically counts up to the tcclr10 value, and is cleared to h'0001. channel 11: channel 11 has a 16-bit free-running counter (tcnt11) and two 16-bit general registers (gr11a, gr11b). tcnt11 is an up-counter that performs free-running operation. the counter can generate an interrupt request when it overflows. when the two general registers (gr11a, gr11b) are designated for compare-match use, a compare-match signal can be output to the apc. prescaler: the atu-ii has a dedicated prescaler with a 2-stage configuration. the first stage comprises 5-bit prescalers (pscr1 to pscr4) that generate a 1/m clock (where m = 1 to 32) with respect to clock p . the second prescaler stage allows selection of a clock obtained by further scaling the clock from the first stage by 2 n (where n = 0 to 5) according to the timer control registers for the respective channels (tcr1a, tcr1b, tcr2a, tcr2b, tcr3 to tcr5, tcr6a, tcr6b, tcr7a, tcr7b, tcr8, tcr11). the prescalers of channels 1 to 8 and 11 have a 2-stage configuration, while the channel 0 and 10 prescalers only have a first stage. the first-stage prescaler is common to channels 0 to 5, 8, and 11, and it is not possible to set different first-stage division ratios for each. channels 6, 7, and 10 each have a first-stage prescaler, and different first-stage division ratios can be set for each. 10.3.2 free-running counter operation and cyclic counter operation the free-running counters (tcnt) in atu-ii channels 0 to 5 and 11 start counting up as free- running counters when the corresponding timer start register (tstr) bit is set to 1. when tcnt overflows (channel 0: from h'ffffffff to h'00000000; channels 1 to 5 and 11: from h'ffff to h'0000), the ovf bit in the timer status register (tsr) is set to 1. if the ove bit in the
340 corresponding timer interrupt enable register (tier) is set to 1 at this time, an interrupt request is sent to the cpu. after overflowing, tcnt starts counting up again from h'00000000 or h'0000. if the tstr value is cleared to 0 during tcnt operation, the corresponding tcnt halts. in this case, tcnt is not reset. if external output is being performed from the gr for the corresponding tcnt, the output value does not change. channel 0 free-running counter operation is shown in figure 10.13. fffffffd p ? tstr tst0 tcnt0 clock tcnt0 tsr0 ovf0 cleared by software 00000002 00000001 00000000 ffffffff fffffffe 00000005 00000004 00000003 00000002 00000001 00000001 figure 10.13 free-running counter operation and overflow timing the free-running counters (tcnt) in atu-ii channels 6 and 7 perform cyclic count operations unconditionally. with channel 3 to 5 free-running counters (tcnt), when the corresponding t3pwm to t5pwm bit in the timer mode register (tmdr) is set to 1, or the corresponding cci bit in the timer i/o control register (tior) is set to 1 when bits t3pwm to t5pwm are 0, the counter for the relevant channel performs a cyclic count. the relevant tcnt counter is cleared by a compare-match of tcnt with gr3d, gr4d, or gr5d in channel 3 to 5, or cylr in channels 6 and 7 (counter clear function). tcnt starts counting up as a cyclic counter when the corresponding str bit in tstr is set to 1 after the tmdr setting is made. when the count value matches the gr3d, gr4d, gr5d, or cylr value, the corresponding imf3d, imf4d, or imf5d bit in the timer status register (tsr) (or the cmf bit in tsr6 or tsr7 for channels 6 and 7) is set to 1, and tcnt is cleared to h'0000 (h'0001 in channels 6 and 7). if the corresponding tier bit is set to 1 at this time, an interrupt request is sent to the cpu. after the compare-match, tcnt starts counting up again from h'0000 (h'0001 in channels 6 and 7). figure 10.14 shows the operation when channel 3 is used as a cyclic counter (with a cycle setting of h'0008).
341 p ? tcnt3 clock tcnt3 gr3d (period) tsr3 imf3d cleared by software cleared by software 0005 0004 0003 0002 0001 0000 0008 0007 0003 0002 0008 0008 0001 0000 0008 figure 10.14 example of cyclic counter operation 10.3.3 compare-match function designating general registers in channels 1 to 5 (gr1a to gr1h, gr2a to gr2h, gr3a to gr3d, gr4a to gr4d, gr5a to gr5d) for compare-match operation in the timer i/o control registers (tior1 to tior5) enables compare-match output to be performed at the corresponding external pins (tio1a to tio1h, tio2a to tio2h, tio3a to tio3d, tio4a to tio4d, tio5a to tio5d). a free-running counter (tcnt) starts counting up when 1 is set in the timer status register (tstr). when the desired number is set beforehand in gr, and the tcnt value matches the gr value, the timer status register (tsr) bit corresponding to gr is set and a waveform is output from the corresponding external pin. 1 output, 0 output, or toggle output can be selected by means of a setting in tior. if the appropriate interrupt enable register (tier) setting is made, an interrupt request will be sent to the cpu when a compare-match occurs. channel 1 and 2 compare-match registers (ocr1, ocr2a to ocr2h) perform compare-match operations unconditionally. however, there are no corresponding output pins. if the appropriate tier setting is made, an interrupt request will be sent to the cpu when a compare-match occurs. channel 1 and 2 gr and ocr registers can send a trigger/terminate signal to channel 8 when a compare-match occurs. in this case, settings should be made in the trigger mode register (trgmdr), timer connection register (tcnr), and one-shot pulse terminate register (otr). an example of compare-match operation is shown in figure 10.15. in the example in figure 10.15, channel 1 is activated, and external output is performed with toggle output specified for gr1a, 1 output for gr1b, and 0 output for gr1c.
342 p ? tcnt1 clock tcnt1 gr1a e 1c tio1a tio1b tio1c tsr1 imf1a e 1d channel 8 start/terminate trigger signal cleared by software cleared by software 0085 0084 0083 0082 0081 0081 0080 007f 007e 003e 0040 003f 003e 003d 003c figure 10.15 compare-match operation 10.3.4 input capture function if input capture registers (icr0a to icr0d) and general registers (gr1a to gr1h, gr2a to gr2h, gr3a to gr3d, gr4a to gr4d, gr5a to gr5d) in channels 0 to 5 and 11 are designated for input capture operation in the timer i/o control registers (tior0 to tior5), input capture is performed when an edge is input at the corresponding external pins (ti0a to ti0d, tio1a to tio1h, tio2a to tio2h, tio3a to tio3d, tio4a to tio4d, tio5a to tio5d). a free-running counter (tcnt) starts counting up when a setting is made in the timer start register (tstr). when an edge is input at an external pin corresponding to icr or gr, the corresponding timer status register (tsr) bit is set and the tcnt value is transferred to icr or gr. rising-edge, falling-edge, or both-edge detection can be selected. by making the appropriate setting in the interrupt enable register (tier), an interrupt request can be sent to the cpu.
343 an example of input capture operation is shown in figure 10.16. in the example in figure 10.16, channel 1 is activated, and input capture operation is performed with both-edge detection specified for tio1a, rising-edge detection for tio1b, and falling-edge detection for tio1c. p ? tcnt1 clock tcnt1 tio1a e 1c gr1a gr1b gr1c tsr1 imf1a tsr1 imf1b tsr1 imf1c 567a 567a 0003 cleared by software cleared by software 567e 567d 567c 567b 567a 5679 5678 0005 0004 0003 0003 0003 0002 0001 0000 figure 10.16 input capture operation 10.3.5 one-shot pulse function channel 8 has sixteen down-counters (dcnt8a to dcnt8p) and corresponding external pins (to8a to to8p) which can be used as one-shot pulse output pins. when a value is set beforehand in dcnt and the corresponding bit in the down-counter start register (dstr) is set, dcnt starts counting down, and at the same time 1 is output from the corresponding external pin. when dcnt reaches h'0000 the down-count stops, the corresponding bit in the timer status register (tsr) is set, and 0 is output from the external pin. the corresponding bit in dstr is cleared automatically. by making the appropriate setting in the interrupt enable register (tier), an interrupt request can be sent to the cpu. an example of one-shot pulse operation is shown in figure 10.17. in the example in figure 10.17, h'0005 is set in dcnt and a down-count is started.
344 p ? dstr dst8a dcnt clock to8a dcnt8a tsr8 synchronized with down-counter clock cleared by software 0000 0001 0002 0003 0004 0005 figure 10.17 one-shot pulse output operation 10.3.6 offset one-shot pulse function and output cutoff function by making an appropriate setting in the timer connection register (tcnr), down-counting by channel 8 down-counters (dcnt8a to dcnt8p) can be started using compare-match signals from channel 1 general registers (gr1a to gr1h) or channel 1 and 2 compare-match registers (ocr1, ocr2a to ocr2h). dcnt8a to dcnt8h are connected to channel 1 ocr1 or gr1a to gr1h, and dcnt8i to dcnt8p are connected to channel 2 ocr2a to ocr2h or gr2a to gr2h. this enables one-shot pulse output from the external pin (to8a to to8p) corresponding to dcnt. the down-count can be forcibly stopped by making a setting in the one-shot pulse terminate register (otr). on channel 1, down-count start or termination by a gr or ocr compare-match can be selected with the trigger mode register (trgmdr). making a setting in the timer start register (tstr) starts an up-count by a free-running counter (tcnt) in channel 1 or 2. when tcnt matches gr or ocr while connection is enabled by tcnr, the corresponding dstr is automatically set and dcnt starts counting down. at the same time, 1 is output from the corresponding external pin (to8a to to8p). by making the appropriate setting in the interrupt enable register (tier), an interrupt request can be sent to the cpu. when tcnt1 matches gr or ocr, or tcnt2 matches gr, while channel 8 one-shot pulse termination by a channel 1 or 2 compare-match signal is enabled by otr, the corresponding dstr is automatically cleared and dcnt stops counting down. dcnt is cleared to h'0000 at this time, and must be rewritten before the down-count is restarted. dcnt8i to dcnt8p are connected to the reload register (rldr8), and when the dstr corresponding to dcnt8i to dcnt8p is set, the dcnt8i to dcnt8p counter loads rldr8 before starting the down-count.
345 an example of the offset one-shot pulse output function and output cutoff function is shown in figure 10.18. in the example shown in this figure, dcnt8i is started by ocr2a of channel 2, and dcnt8i output is cut off by gr2a. p down-count start trigger (corresponding bit) terminate trigger (ostrg0a-p) first prescaler 1 second prescaler 1 start trigger (ostrg1a-p) down-counter 10a-10p clock down-counter 10a-10p one-shot pulse (toa10-top10) one-shot end interrupt (flag) one-shot end detection signal synchronized with down-counter clock 0000 0003 0004 0005 0006 0007 0008 0009 figure 10.18 offset one-shot pulse output function and output cutoff function operation 10.3.7 interval timer operation the interval interrupt request registers (itvrr1, itvrr2a, itvrr2b) are connected to bits 6 to 9 and 10 to 13 of the channel 0 free-running counter (tcnt0). the itvrr registers are 8-bit registers; the upper 4 bits (itva) are used for a/d converter activation, and the lower 4 bits (itve) are used for interrupt requests. itvrr1 is connected to a/d converter 2 (ad2), itvrr2a to a/d converter 0 (ad0), and itvrr2b to a/d converter 1 (ad1). when the itva bit for the desired timing is set, the a/d converter is activated when the corresponding bit of tcnt0 changes to 1. when the itve bit for the desired timing is set, an interrupt can be requested when the corresponding bit of tcnt0 changes to 1. at this time, the corresponding bit of the timer status
346 register (tsr0) is set. there are four interrupt sources for the respective itvrr registers, but there is only one interrupt vector. to suppress interrupts and a/d converter activation, itvrr bits should be cleared to 0. an example of interval timer function operation is shown in figure 10.19. in the example in figure 10.19, tcnt0 is started by setting itve to 1 in itvrr1. p ? tcnt0 clock internal detection signal ad activation trigger tcnt0 in case of bit 6 detection in case of bit 7 detection 0000007e 00000085 00000084 00000083 00000082 00000081 00000080 0000007f 00000040 0000003f 0000003e 0000003d 0000003c figure 10.19 interval timer function 10.3.8 twin-capture function channel 0 input capture register icr0a, channel 1 offset base register 1 (osbr1), and channel 2 offset base register 2 (osbr2) can be made to perform input capture in response to the same trigger by means of a setting in timer i/o control register 0 (tior0). when tcnt0, tcnt1a, and tcnt2a in channel 0, channel 1, and channel 2 are started by a setting in the timer status register (tsr), and an edge is input to icr0a, the tcnt1a value is transferred to osbr1, and the tcnt2a value to osbr2. edge detection is as described in section 10.3.4, input capture function. an example of twin-capture operation is shown in figure 10.20.
347 p ? tcnt1a clock tcnt1a osbr1 567a edge detection signal (from channel 0) 567e 567d 567c 567b 567a 5679 5678 0005 0004 0003 0002 0001 0000 0003 figure 10.20 twin-capture operation 10.3.9 pwm timer function channels 6 and 7 can be used unconditionally as pwm timers using external pins (to6a to to6d, to7a to to7d). in channels 6 and 7, when the corresponding bit is set in the timer start register (tstr) and the free-running counter (tcnt) is started, the counter counts up until its value matches the corresponding cycle register (cylr). when tcnt matches cylr, it is cleared to h'0001 and starts counting up again from that value. at this time, 1 is output from the corresponding external pin. an interrupt request can be sent to the cpu by setting the corresponding bit in the timer interrupt enable register (tier). if a value has been set in the duty register (dtr), when tcnt matches dtr, 0 is output to the corresponding external pin. if the dtr value is h'0000, the output does not change (0% duty). a duty of 100% is specified by setting dtr = cylr. do not set a value in dtr that will result in the condition dtr > cylr. channels 6 and 7 have buffers (bfr); the bfr value is transferred to dtr when tcnt matches cylr. the duty value written into bfr is reflected in the output value in the cycle following that in which bfr is written to. an example of pwm timer operation is shown in figure 10.21. in the example in figure 10.21, h'0004 is set in channel 6 cylr6a, and h'0002, h'0000 (0%), h'0004 (100%), and h'0001 in bfr6a.
348 p ? tst6a tcnt6a clock tcnt6a cylr6a bfr6a dtr6a to6a tsr6 write to bfr6a no pwm output for 1 cycle after activation cycle cycle cycle data = 0000 data = 0004 data = 0001 cycle duty = 100% cycle duty = 0% cleared by software cleared by software cleared by software 0001 0004 0000 0002 0002 0004 0003 0002 0001 0004 0003 0002 0001 0004 0003 0002 0001 0004 0003 0002 0001 0001 0002 0003 0004 0001 0004 0000 figure 10.21 pwm timer operation channel 6 can be used in complementary pwm mode by making a setting in the pwm mode control register (pmdr). on-duty or off-duty can also be selected with a setting in pmdr. when tcnt6 is started by a setting in tstr, it starts counting up. when tcnt6 reaches the cylr6 value, it starts counting down, and on reaching h'000, starts counting up again. the counter status is shown by tsr6. when tcnt6 underflows, an interrupt request can be sent to the cpu by setting the corresponding bit in tier. when tcnt6 matches the duty register (dtr6) value, the output is inverted. the output prior to the match depends on the pmdr setting. when a value including dead time is set in dtr6, a maximum of 4-phase pwm output is possible. data transfer from bfr6 to dtr6 is performed when tcnt6 underflows. an example of channel 6 complementary pwm mode operation is shown in figure 10.22. in the example in figure 10.22, h'0004 is set in channel 6 cylr6a, and h'0002, h'0003, h'0004 (100%), and h'0000 (0%) in bfr6a.
349 p ? cycle cycle cycle duty = 100% cycle duty = 0% cycle data = 0003 data = 0004 data = 0000 up up up up up down down down down down no pwm output for 1 cycle after activation tst6a tcnt6a clock tcnt6a up-/down- count tcnt6a cylr6a write to bfr6a bfr6a dtr6a to6a tsr6 00 01 00 02 00 03 00 04 00 03 00 02 00 01 00 00 00 01 00 02 00 03 00 04 00 03 00 02 00 01 00 00 00 01 00 02 00 03 00 04 00 03 00 02 00 01 00 00 00 01 00 02 00 03 00 04 00 03 00 02 00 01 00 01 00 00 00 01 00 02 00 03 00 04 00 03 00 02 0004 0002 0002 0003 0003 0004 0004 0000 0000 cleared by software cleared by software cleared by software figure 10.22 complementary pwm mode operation 10.3.10 channel 3 to 5 pwm function pwm mode is selected for channels 3 to 5 by setting the corresponding bits to 1 in the timer mode register (tmdr), enabling the channels to operate as pwm timers with the same cycle. in pwm mode, general registers d (gr3d, gr4d, gr5d) are used as cycle registers, and general registers a to c (gr3a to gr3c, gr4a to gr4c, gr5a to gr5c) as duty registers. the external pins (tio3a to tio3c, tio4a to tio4c, tio5a to tio5c) corresponding to the grs used as duty registers are used as pwm outputs. external pins tio3d, tio4d, and tio5d should not be used as timer outputs. the free-running counter (tcnt) is started by making a setting in the timer start register (tstr), and when tcnt reaches the cycle register (gr3d, gr4d, gr5d) value, a compare-match is generated and tcnt starts counting up again from h'0000. at the same time, the corresponding bit is set in the timer status register (tsr) and 1 is output from the corresponding external pin. when tcnt reaches the duty register (gr3a to gr3c, gr4a to gr4c, gr5a to gr5c) value, 0 is output to the external pin. the corresponding status flag is not set. when pwm operation is performed by starting the free-running counter from its initial value of h'0000, pwm output is not performed for one cycle. to perform immediate pwm output, the value in the cycle register must be set in the free-running counter before the counter is started. if pwm operation is performed
350 after setting h'ffff in the cycle register, the cycle register? compare-match flag and overflow flag will be set simultaneously. note that 0% or 100% duty output is not possible in channel 3 to 5 pwm mode. an example of channel 3 to 5 pwm mode operation is shown in figure 10.23. in the example in figure 10.23, h'f0008 is set in gr3d, h'0002 is set in gr3a, gr3b, and gr3c, and channel 3 is activated; then, during operation, h'0000 is set in gr3a, gr3b, and gr3c, and output is performed to external pins tioa3 to tioc3. note that 0% duty output is not possible even though h'0000 is set. p ? tcnt3 clock tcnt3 gr3d gr3a e 3c (pulse width) tsr3 tio3a e tio3c 0000 cleared by software 0005 0004 0003 0002 0001 0000 0008 0007 0003 0002 0008 0000 0001 0002 0008 0008 cleared by software rewritten by software figure 10.23 channel 3 to 5 pwm mode operation 10.3.11 event count function and event cycle measurement channel 9 has six 8-bit event counters (ecnt9a to ecnt9f) and corresponding general registers (gr9a to gr9f). each event counter has an external pin (ti9a to ti9f). each ecnt9 operates unconditionally as an event counter. when an edge is input from the external pin, ecnt9 is incremented. when ecnt9 matches the value set in gr9, it is cleared, and then counts up when an edge is again input at the external pin. by making the appropriate setting in the interrupt enable register (tier) beforehand, an interrupt request can be sent to the cpu on compare-match. for ecnt9a to ecnt9d, a trigger can be transmitted to channel 3 when a compare-match occurs. in channel 3, if the channel 9 trigger input is set in the timer i/o control register (tior) and the corresponding bit is set to 1 in the timer start register (tstr), the tcnt3 value is captured in the corresponding general register (gr3a to gr3d) when an ecnt9a to ecnt9d compare-match occurs. this enables the event cycle to be measured.
351 an example of event count operation is shown in figure 10.24. in this example, ecnt9a counts up on both-edge, falling-edge, and rising-edge detection, h'10 is set in gr9a, and a compare- match is generated. an example of event cycle measurement operation is shown in figure 10.24. in this example, gr3a in channel 3 captures tcnt3 in response to a trigger from channel 9. p ? ti9a gr9a ecnt9a edge detection signal capture trigger to channel 3 tsr9 cmf9a ecnt9a clock 02 00 01 03 10 10 00 05 06 falling edge rising edge rising and falling edges cleared by software figure 10.24 event count operation p ? tcnt3 clock tcnt3 gr3a compare-match trigger (from channel 9) tsr3 imf3a 0003 567a 567e 567d 567c 567b 567a 5679 5678 0005 0004 0003 0002 0001 0000 cleared by software figure 10.25 event cycle measurement operation
352 10.3.12 channel 10 functions inter-edge measurement function and edge input cessation detection function: 32-bit input capture register 10a (icr10a) and 32-bit output compare register 10a (ocr10a) in channel 10 unconditionally perform input capture and compare-match operations, respectively. these registers are connected to 32-bit free-running counter tcnt10a. when the corresponding bit is set in the timer start register (tstr), the entire channel 10 starts operating. icr10a has an external input pin (ti10), and when an edge is input at this input pin, icr10a captures the tcnt10a value. at this time, tcnt10a is cleared to h'00000001. the captured value is transferred to the read register (rld10c) in the multiplied clock generation block. by making the appropriate setting in the interrupt enable register (tier), an interrupt request can be sent to the cpu. this allows inter-edge measurement to be carried out. when tcnt10a reaches the value set in ocr10a, a compare-match interrupt can be requested. in this way it is possible to detect the cessation of edge input beyond the time set in ocr10a. the input edge from ti10 is synchronized internally; the internal signal is agck. noise cancellation is possible for edges input at ti10 using the timer 10h (tcnt10h) input cancellation function by setting the nce bit in timer control register tcr10. when an edge is input at ti10, tcnt10h starts and input is disabled until it reaches compare-match register ncr10. edge input operation without noise cancellation is shown in figure 10.26, edge input operation with noise cancellation in figure 10.27, and tcnt10a capture operation and compare-match operation in figure 10.28. p ? ti10 agck after internal synchronization 1 after internal synchronization 2 agck operation tcnt clock when falling edge is set when rising edge is set when rising and falling edges are set figure 10.26 edge input operation (without noise cancellation)
353 p ? ti10 tcnt10h p 10 (clock) ncr10 agck 0 01 1 external edge mask period external edge mask period note: when rising and falling edges are set noise cancellation period agck operation tcnt clock figure 10.27 edge input operation (with noise cancellation) p ? tstr tst10 tcnt10a clock agck icr10a ocr10a capture transfer signal tcnt reset signal tsr10 cmf10a tsr10 imf10a 1234 5678 cleared by software 55555556 cleared by software 12345678 00000000 55555556 55555557 55555555 00000000 12345677 00000003 00000001 00000002 figure 10.28 tcnt10a capture operation and compare-match operation internally synchronized agck is counted by event count 10b (tcnt10b), and when tcnt10b reaches the value set beforehand in compare-match register 10b (ocr10b), a compare-match occurs, and the compare-match trigger signal is transmitted to channel 0. by setting the corresponding bit in tier, an interrupt request can be sent to the cpu.
354 figure 10.29 shows tcnt10b compare-match operation. p ? agck tcnt10b clock tcnt10b channel 0 trigger ocr10b tsr10 cmf10b 55 55 00 01 56 cleared by software figure 10.29 tcnt10b compare-match operation multiplied clock generation function: the channel 10 16-bit reload counter (tcnt10c, rld10c) and 16-bit free-running counter 10g (tcnt10g) can be used to multiply the interval between edges input from external pin ti10 by 32, 64, 128, or 256. the value captured in icr10a above is multiplied by 1/32, 1/64, 1/128, or 1/256 according to the value set in the timer i/o control register (tior10), and transferred to the reload buffer (rld10c). at the same time, the same value is transferred to 16-bit reload counter 10c (tcnt10c) and a down-count operation is started. when this counter reaches h'0001, the value is read automatically from rld10c and the down-count operation is repeated. when this reload occurs, a multiplied clock signal (agck1) is generated. agck1 is converted to a corrected clock (agckm) by the multiplied clock correction function described in the following section. channel 10 can also perform compare-match operation by means of the multiplied clock (agck1) using general register 10g (gr10g) and 16-bit free-running counter 10g (tcnt10g). tcnt10g is incremented unconditionally by agck1. by making the appropriate setting in the interrupt enable register (tier), an interrupt request can be sent to the cpu when tcnt10g and gr10g match. the timing of this interrupt can be selected with the ireg bit in tier as either on occurrence of the compare-match or on input of the first ti10 edge after the compare-match. tcnt10c operation is shown in figure 10.30, and tcnt10g compare-match operation in figure 10.31.
355 p ? tst10 agck icr10a rld10c write enable signal tcnt10c shifter output rld10c rld10c load signal agck1 rlden note: in case of multiplication factor of 32 initial value set by software not loaded when rlden = 1 rlden set to 0 by software rlden set to 1 by software 1ck 1ck 00000020 00000000 0000 0002 0001 0001 0001 0001 0001 0001 0002 0002 0001 0002 0001 0001 figure 10.30 tcnt10c operation p ? agck agck1 tcnt10g tsr10 cmf10g gr10g tsr10 cmf10g 0000 0034 0000 cleared by agck 0001 0036 0035 when ireg = 1 0034 0002 0001 write by software when ireg = 0 figure 10.31 tcnt10g compare-match operation
356 multiplied clock correction function: channel 10? three 16-bit correction counters (tcnt10d, tcnt10e, tcnt10f) and correction counter clear register (tcclr10) have a correction function that makes the interval between edges input from ti10 the frequency multiplication value set in tior10. when agck is input, the value in tcnt10d multiplied by the multiplication factor set in tior10 is transferred to tcnt10e. at the same time, tcnt10d is incremented. tcnt10e counts up on agck1. tcnt10e loads tcnt10d on agck, and counts up again on agck1. using the counter correction select bit (ccs) in tior10, it is possible to select whether or not tcnt10e is halted when tcnt10d = tcnt10e. tcnt10f has the peripheral clock (p ) as its input and is constantly compared with tcnt10e. when the tcnt10f value is smaller than that in tcnt10e, tcnt10f is incremented and outputs a corrected multiplied clock signal (agckm). when the tcnt10e value exceeds the tcnt10f value (when tcnt10e loads tcnt10d), no count-up operation is performed. agckm is output to the channel 1 to 5 free-running counters (tcnt1 to tcnt5). channel 10 also has a correction counter clear register (tcclr10). the correction counters (tcnt10d, tcnt10e, tcnt10f) and channel 1 and 2 free-running counters (tcnt1 and tcnt2) can be cleared when tcnt10f reaches the value set in tcclr10. tcnt10d operation is shown in figure 10.32, tcnt10e operation in figure 10.33, tcnt10f operation (at startup) in figure 10.34, tcnt10f operation (end of cycle, with correction) in figure 10.35, and tcnt10f operation (end of cycle, without correction) in figure 10.36. p ? tst10 agck tcnt10d clock shifter output tcnt10d 02 01 00 03 0000 note: in case of multiplication factor of 32 0060 0040 0020 figure 10.32 tcnt10d operation
357 p ? tst10 agck tcnt10e valid agck1 tcnt10e tcnt10d (shift amount) initial value load corrected value load corrected value load note: in case of multiplication factor of 32 00 44 00 43 00 42 00 41 0039 0040 0060 0038 0022 0021 0020 0023 0004 0022 0003 0002 0001 0040 0020 0000 0024 00 00 figure 10.33 tcnt10e operation p ? tst10 agck tcnt10e tcnt10e clock tcnt10f agckm tcnt clock operating on agckm tcnt1, tcnt2 reset trigger tcnt1, tcnt2 tcnt10d 0024 note: multiplication factor of 32, tcclr10 = h'0080 same value as cycle register set by software 0027 0027 0026 0026 0025 0025 0024 0023 0022 0021 0020 0024 0022 0023 0004 0003 0002 0001 0000 0023 0022 0004 0003 0002 0001 0080 0000 0001 0002 0003 0022 0023 0024 0025 0026 02 01 00 figure 10.34 tcnt10f operation (at startup)
358 p ? tst10 agck tcnt10e tcnt10e clock tcnt10f agckm tcnt clock operating on agckm tcnt1, tcnt2 reset trigger tcnt1, tcnt2 tcnt10d note: multiplication factor of 32, tcclr10 = h'0080 0002 0003 0001 00 00 007a 0079 0078 0077 0076 0066 0065 0064 0063 0062 0061 005a 0060 005a 0063 0064 0065 0066 0076 0077 0078 0079 007a 0080 00 01 0002 0003 0003 0002 0000 007a 0079 00 01 0078 0077 0076 0065 0064 0063 00 66 01 00 03 02 cleared to h'00 by software figure 10.35 tcnt10f operation (end of cycle, acceleration, deceleration)
359 p ? tst10 agck tcnt10e tcnt10e clock tcnt10f agckm tcnt clock operating on agckm tcnt1, tcnt2 reset trigger tcnt1, tcnt2 tcnt10d note: multiplication factor of 32, tcclr10 = h'0080 set to h'00 by software 01 0002 0001 00 03 02 005a 0063 0064 0065 00 66 007e 007f 0000 0003 0002 0003 0002 0001 0080 0082 0001 00 00 0080 0081 007f 007e 007f 0066 007e 0066 0065 0064 0064 0065 0063 0063 0062 0061 0060 005a 005a figure 10.36 tcnt10f operation (end of cycle, steady-state)
360 10.4 interrupts the atu has 75 interrupt sources of five kinds: input capture interrupts, compare-match interrupts, overflow interrupts, underflow interrupts, and interval interrupts. 10.4.1 status flag setting timing imf (icf) setting timing in input capture: when an input capture signal is generated, the imf bit and icf bit are set to 1 in the timer status register (tsr), and the tcnt value is simultaneously transferred to the corresponding gr, icr and osbr. the timing in this case is shown in figure 10.37. in the example in figure 10.37, a signal is input from an external pin, and input capture is performed on detection of a rising edge. ck input capture input tcnt n gr (icr) n internal input capture signal interrupt status flag imf (icf) interrupt request signal imi (ici) t tics (input capture input setup time) figure 10.37 imf (icf) setting timing in input capture
361 imf (icf) setting timing in compare-match: the imf bit and cmf bit are set to 1 in the timer status register (tsr) by the compare-match signal generated when the general register (gr) output compare register (ocr), or cycle register (cylr) value matches the timer counter (tcnt) value. the compare-match signal is generated in the last state of the match (when the matched tcnt count value is updated). the timing in this case is shown in figure 10.38. ck tcnt gr(cylr) n n n + 1 tcnt input clock compare-match signal interrupt status flag imf (cmf) interrupt request signal imi (cmi) figure 10.38 imf (cmf) setting timing in compare-match
362 ovf setting timing in overflow: when tcnt overflows (from h'ffff to h'0000, or from h'ffffffff to h'00000000), the ovf bit is set to 1 in the timer status register (tsr). the timing in this case is shown in figure 10.39. ck tcnt h'ffff h'0000 tcnt input clock overflow signal interrupt status flag ovf interrupt request signal ovi figure 10.39 ovf setting timing in overflow
363 osf setting timing in underflow: when a down-counter (dcnt) counts down from h'0001 to h'0000 on dcnt input clock input, the osf bit is set to 1 in the timer status register (tsr) when the next dcnt input clock pulse is input (when underflow occurs). however, when dcnt is h'0000, it remains unchanged at h'0000 no matter how many dcnt input clock pulses are input. when dcnt is cleared by means of the one-shot pulse function, the osf bit is cleared when the next dcnt input clock is input. the timing in this case is shown in figure 10.40. ck dcnt dcnt input clock underflow signal interrupt status flag osf interrupt request signal osi h'0001 h'0000 h'0000 figure 10.40 osf setting timing in underflow
364 timing of iif setting by interval timer: when 1 is generated by anding the rise of bit 10 to 13 in free-running counter tcnt0l with bit itve0 to itve3 in the interval interrupt request register (itvrr), the iif bit is set to 1 in the timer status register (tsr). the timing in this case is shown in figure 10.41. tcnt0 value n in the figure is the counter value when tcnt0l bit 6 to 13 changes to 1. (for example, n = h'00000400 in the case of bit 10, h'00000800 in the case of bit 11, etc.) ck tcnt0 tcnt input clock internal interval signal interrupt status flag iif interrupt request signal n ?1 n figure 10.41 timing of iif setting timing by interval timer
365 10.4.2 status flag clearing clearing by cpu program: the interrupt status flag is cleared when the cpu writes 0 to the flag after reading it while set to 1. the procedure and timing in this case are shown in figure 10.42. start read 1 from tsr write 0 to tsr interrupt status flag cleared ck tsr address internal write signal figure 10.42 procedure and timing for clearing by cpu program
366 clearing by dmac: the interrupt status flag (icf0a to icf0d, cmf6a to cmf6d, cmf7a to cmf7d) is cleared automatically during data transfer when the dmac is activated by input capture or compare-match. the procedure and timing in this case are shown in figure 10.43. start interrupt status flag cleared during data transfer ck clear request signal from dmac figure 10.43 procedure and timing for clearing by dmac
367 10.5 cpu interface 10.5.1 registers requiring 32-bit access free-running counters 0 and 10a (tcnt0, tcnt10a), input capture registers 0a to 0d and 10a (icr0a to icr0d, icr10a), and output compare register 10a (ocr10a) are 32-bit registers. as these registers are connected to the cpu via an internal 16-bit data bus, a read or write (read only, in the case of icr0a to icr0d and icr10a) is automatically divided into two 16-bit accesses. figure 10.44 shows a read from tcnt0, and figure 10.45 a write to tcnt0. when reading tcnt0, in the first read the tcnt0h (upper 16-bit) value is output to the internal data bus, and at the same time, the tcnt0l (lower 16-bit) value is output to an internal buffer register. then, in the second read, the tcnt0l (lower 16-bit) value held in the internal buffer register is output to the internal data bus. when writing to tcnt0, in the first write the upper 16 bits are output to an internal buffer register. then, in the second write, the lower 16 bits are output to tcnt0l, and at the same time, the upper 16 bits held in the internal buffer register are output to tcnt0h to complete the write. the above method performs simultaneous reading and simultaneous writing of 32-bit data, preventing contention with an up-count. 1st read operation 2nd read operation cpu cpu internal data bus hh internal data bus l l l bus interface internal buffer register tcnt0h tcnt0l tcnt0h tcnt0l module data bus bus interface internal buffer register module data bus module data bus figure 10.44 read from tcnt0
368 1st write operation 2nd write operation cpu internal data bus h h lh bus interface internal buffer register tcnt0h tcnt0l tcnt0h tcnt0l module data bus cpu internal data bus l bus interface internal buffer register module data bus module data bus figure 10.45 write to tcnt0
369 10.5.2 registers permitting 8-bit, 16-bit, or 32-bit access timer registers 1, 2, and 3 (tstr1, tstr2, tstr3) are 8-bit registers. as these registers are connected to the cpu via an internal 16-bit data bus, a simultaneous 32-bit read or write access to tstr1, tstr2, and tstr3 is automatically divided into two 16-bit accesses. figure 10.46 shows a read from tstr, and figure 10.47 a write to tstr. when reading tstr, in the first read the tstr1 and tstr2 (upper 16-bit) value is output to the internal data bus. then, in the second read, the tstr3 (lower 16-bit) value is output to the internal data bus. when writing to tstr, in the first write the upper 16 bits are written to tstr1 and tstr2. then, in the second write, the lower 16 bits are written to tstr3. note that, with the above method, in a 32-bit write the write timing is not the same for tstr1/tstr2 and tstr3. for information on 8-bit and 16-bit access, see section 10.5.4, 8-bit or 16-bit accessible registers. 1st read operation 2nd read operation cpu cpu internal data bus hh internal data bus l l bus interface tstr2 tstr1 tstr3 tstr2 tstr1 tstr3 module data bus bus interface module data bus figure 10.46 read from tstr1, tstr2, and tstr3
370 1st write operation 2nd write operation cpu internal data bus h h l bus interface tstr2 tstr1 tstr3 tstr2 tstr1 tstr3 module data bus cpu internal data bus l bus interface module data bus figure 10.47 write to tstr1, tstr2 and tstr3 10.5.3 registers requiring 16-bit access the free-running counters (tcnt; but excluding tcnt0, tcnt10a, tcnt10b, tcnt10d, and tcnt10h), the general registers (gr; but excluding gr9a to gr9d), down-counters (dcnt), offset base register (osbr), cycle registers (cylr), buffer registers (bfr), duty registers (dtr), timer connection register (tcnr), one-shot pulse terminate register (otr), down-count start register (dstr), output compare registers (ocr: but excluding ocr10b), reload registers (rldr8, rld10c), correction counter clear register (tcclr10), timer interrupt enable register (tier), and timer status register (tsr) are 16-bit registers. these registers are connected to the cpu via an internal 16-bit data bus, and can be read or written (read only, in the case of osbr) a word at a time. figure 10.48 shows the operation when performing a word read or write access to tcnt1a. cpu internal data bus tcnt1a module data bus bus interface figure 10.48 tcnt1a read/write operation
371 10.5.4 8-bit or 16-bit accessible registers the timer control registers (tcr1a, tcr1b, tcr2a, tcr2b, tcr6a, tcr6b, tcr7a, tcr7b), timer i/o control registers (tior1a to tior1d, tior2a to tior2d, tior3a, tior3b, tior4a, tior4b, tior5a, tior5b), and the timer start register (tstr1, tstr2, tstr3) are 8-bit registers. these registers are connected to the upper 8 bits or lower 8 bits of the internal 16-bit data bus, and can be read or written a byte at a time. in addition, a pair of 8-bit registers for which only the least significant bit of the address is different, such as timer i/o control register 1a (tior1a) and timer i/o control register 1b (tior1b), can be read or written in combination a word at a time. figures 10.49 and 10.50 show the operation when performing individual byte read or write accesses to tior1a and tior1b. figure 10.51 shows the operation when performing a word read or write access to tior1a and tior1b simultaneously. cpu internal data bus only upper 8 bits used only upper 8 bits used tior1b tior1a module data bus bus interface figure 10.49 byte read/write access to tior1b cpu internal data bus only lower 8 bits used only lower 8 bits used tior1b tior1a module data bus bus interface figure 10.50 byte read/write access to tior1a cpu internal data bus tior1b tior1a module data bus bus interface figure 10.51 word read/write access to tior1a and tior1b
372 10.5.5 registers requiring 8-bit access the timer mode register (tmdr), prescaler register (pscr), timer i/o control registers (tior0, tior10, tior11), trigger mode register (trgmdr), interval interrupt request register (itvrr), timer control registers (tcr3, tcr4, tcr5, tcr8, tcr9a to tcr9c, tcr10, tcr11), pwm mode register (pmdr), reload enable register (rldenr), free-running counters (tcnt10b, tcnt10d, tcnt10h), event counter (ecnt), general registers (gr9a to gr9f), output compare register (ocr10b), and noise canceler register (ncr) are 8-bit registers. these registers are connected to the upper 8 bits of the internal 16-bit data bus, and can be read or written a byte at a time. figure 10.52 shows the operation when performing individual byte read or write accesses to itvrr1. cpu internal data bus only upper 8 bits used only upper 8 bits used itvrr1 module data bus bus interface figure 10.52 byte read/write access to itvrr1 10.6 sample setup procedures sample setup procedures for activating the various atu-ii functions are shown below. sample setup procedure for input capture: an example of the setup procedure for input capture is shown in figure 10.53. 1. select the first-stage counter clock ? in prescaler register (pscr) and the second-stage counter clock ? with the cksel bit in the timer control register (tcr). when selecting an external clock, also select the external clock edge type with the ckeg bit in tcr. 2. set the port control register, corresponding to the port for signal input as the input capture trigger, to atu input capture input. 3. select rising edge, falling edge, or both edges as the input capture signal input edge(s) with the timer i/o control register (tior). if necessary, a timer interrupt request can be sent to the cpu on input capture by making the appropriate setting in the interrupt enable register (tier). in channel 0, setting the dmac allows dmac activation to be performed. 4. set the corresponding bit to 1 in the timer start register (tstr) to start the free-running counter (tcnt) for the relevant channel. note: when input capture occurs, the counter value is always captured, irrespective of free- running counter (tcnt) activation.
373 select counter clock 1 set port-atu-ii connection 2 set input waveform edge detection 3 start counter 4 input capture operation start figure 10.53 sample setup procedure for input capture sample setup procedure for waveform output by output compare-match: an example of the setup procedure for waveform output by output compare-match is shown in figure 10.54. 1. select the first-stage counter clock ? in prescaler register (pscr), and the second-stage counter clock ? with the cksel bit in the timer control register (tcr). when selecting an external clock, also select the external clock edge type with the ckeg bit in tcr. 2. set the port control register corresponding to the waveform output port to atu output compare-match output. also set the corresponding bit to 1 in the port io register to specify the output attribute for the port. 3. select 0, 1, or toggle output for output compare-match output with the timer i/o control register (tior). if necessary, a timer interrupt request can be sent to the cpu on output compare-match by making the appropriate setting in the interrupt enable register (tier). 4. set the timing for compare-match generation in the atu general register (gr) corresponding to the port set in 2. 5. set the corresponding bit to 1 in the timer start register (tstr) to start the free-running counter (tcnt). waveform output is performed from the relevant port when the tcnt value and gr value match.
374 select counter clock 1 set port-atu-ii connection 2 select waveform output mode 3 set output timing 4 start counter 5 waveform output start figure 10.54 sample setup procedure for waveform output by output compare-match
375 sample setup procedure for channel 0 input capture triggered by channel 10 compare- match: an example of the setup procedure for compare-match transmission is shown in figure 10.55. 1. set the timing for compare-match generation in the channel 10 output compare register (ocr10b). 2. set the trg0den bit to 1 in the channel 10 timer control register (tcr10). 3. set the corresponding bit to 1 in the timer start register (tstr) to start the channel 10 free- running counter (tcnt10b). on compare-match between tcnt10b and ocr10b, the compare-match signal is transmitted to channel 0 as the channel 0 icr0d input capture signal. set compare-match 1 set tcr10 2 start counter 3 signal transmission start figure 10.55 sample setup procedure for compare-match signal transmission
376 sample setup procedure for one-shot pulse output: an example of the setup procedure for one-shot pulse output is shown in figure 10.56. 1. set the first-stage counter clock ? in prescaler register 1 (pscr1), and select the second-stage counter clock ? with the cksel bit in timer control register8 tcr8. 2. set port k control registers h and l (pkcrh, pkcrl) corresponding to the waveform output port to atu one-shot pulse output. also set the corresponding bit to 1 in the port k io register (pkior) to specify the output attribute. 3. set the one-shot pulse width in the down-counter (dcnt) corresponding to the port set in (2). if necessary, a timer interrupt request can be sent to the cpu when the down-counter underflows by making the appropriate setting in the interrupt enable register (tier8). 4. set the corresponding bit (dst8a to dst8p) to 1 in the down-count start register (dstr) to start the down-counter (dcnt). select counter clock 1 set port-atu-ii connection 2 set pulse width 3 start down-count 4 one-shot pulse output start figure 10.56 sample setup procedure for one-shot pulse output
377 sample setup procedure for offset one-shot pulse output/cutoff operation: an example of the setup procedure for offset one-shot pulse output is shown in figure 10.57. 1. set the first-stage counter clock ? in prescaler register 1 (pscr1), and select the second-stage counter clock ? with the cksel bit in the timer control register (tcr1, tcr2, tcr8). 2. set port k control registers h and l (pkcrh, pkcrl) corresponding to the waveform output port to atu one-shot pulse output. also set the corresponding bit to 1 in the port k io register (pkior) to specify the output attribute 3. set the one-shot pulse width in the down-counter (dcnt) corresponding to the port set in (2). if necessary, a timer interrupt request can be sent to the cpu when the down-counter underflows by making the appropriate setting in the interrupt enable register (tier8). 4. set the offset width in the channel 1 or 2 general register (gr1a to gr1h, gr2a to gr2h) connected to the down-counter (dcnt) corresponding to the port set in 2, and in the output compare register (ocr1, ocr2a to ocr2h). set the timer i/o control register (tior1a to tior1d, tior2a to tior2d) to the compare-match enabled state. 5. set the start/terminate trigger by means of the trigger mode register (trgmdr), timer connection register (tcnr), and one-shot pulse terminate register (otr), so that it corresponds to the port set in step 2 above. 6. set the corresponding bit to 1 in the timer start register (tstr) to start the channel 1 or 2 free- running counter (tcnt1, tcnt2). when the tcnt value and gr value or ocr value match, the corresponding dcnt starts counting down or is forcibly cleared, and one-shot pulse output is performed.
378 select counter clock 1 set port-atu connection 2 set pulse width 3 set offset width 4 set offset operation 5 start count 6 offset one-shot pulse output start figure 10.57 sample setup procedure for offset one-shot pulse output
379 sample setup procedure for interval timer operation: an example of the setup procedure for interval timer operation is shown in figure 10.58. 1. set the first-stage counter clock ? in prescaler register 1 (pscr1). 2. set the itve bit to be used in the interval interrupt request register (itvrr) to 1. an interrupt request can be sent to the cpu when the corresponding bit changes to 1 in the channel 0 free- running counter (tcnt0). to start a/d converter sampling, set the itva bit to be used in itvrr to 1. 3. set bit 0 to 1 in the timer start register (tstr) to start tcnt0. select counter clock 1 set interval 2 start counter 3 interrupt request to cpu or start of a/d0 sampling start figure 10.58 sample setup procedure for interval timer operation
380 sample setup procedure for pwm timer operation (channels 3 to 5 ): an example of the setup procedure for pwm timer operation (channels 3 to 5 ) is shown in figure 10.59. 1. set the first-stage counter clock ? in prescaler register 1 (pscr1), and select the second-stage counter clock ? with the cksel bit in the timer control register (tcr). when selecting an external clock, at the same time select the external clock edge type with the ckeg bit in tcr. 2. set the port control registers (pxcrh, pxcrl) corresponding to the waveform output port to atu output compare-match output. also set the corresponding bit to 1 in the port io register (pxior) to specify the output attribute. 3. set bit t3pwm to t5pwm in the timer mode register (tmdr) to pwm mode. when pwm mode is set, the timer operates in pwm mode irrespective of the timer i/o control register (tior) contents, and general registers (gr3a to gr3d, gr4a to gr4d, gr5a to gr5d) can be written to. 4. the gr3a to gr3c, gr4a to gr4c, and gr5a to gr5c atu general registers are used as duty registers (dtr), and the gr3d, gr4d, and gr5d atu general registers as cycle registers (cylr). set the pwm waveform output 0 output timing in dtr, and the pwm waveform output 1 output timing in cylr. also, if necessary, interrupt requests can be sent to the cpu at the 0/1 output timing by making a setting in the timer interrupt enable register (tier). 5. set the corresponding bit to 1 in the timer start register (tstr) to start the free-running counter (tcnt) for the relevant channel.
381 select counter clock 1 set port-atu connection 2 set pwm timer 3 set gr 4 start count 5 pwm waveform output start figure 10.59 sample setup procedure for pwm timer operation (channels 3 to 5)
382 sample setup procedure for pwm timer operation (channels 6 and 7): an example of the setup procedure for pwm timer operation (channels 6 and 7) is shown in figure 10.60. 1. set the first-stage counter clock ? in prescaler register 2 and 3 (pscr2, pscr3), and select the second-stage counter clock ? with the cksel bit in the timer control register (tcr6a, tcr6b, tcr7a, tcr7b). 2. set the port b control register l (pbcrl) corresponding to the waveform output port to atu pwm output. also set the corresponding bit to 1 in the port b io register (pbior) to specify the output attribute. 3. set pwm waveform output 1 output timing in the cycle register (cylr6a to cylr6d, cylr7a to cylr7d), and set the pwm waveform output 0 output timing in the buffer register (bfr6a to bfr6d, bfr7a to bfr7d) and duty register (dtr6a to dtr6d, dtr7a to dtr7d). if necessary, an interrupt request can be sent to the cpu on a compare- match between the cylr value and the free-running counter (tcnt) value by making the appropriate setting in the timer interrupt enable register (tier). in addition, setting the dmac allows dmac activation to be performed. 4. set the corresponding bit to 1 in the timer start register (tstr) to start the tcnt counter for the relevant channel. notes: 1. do not make a setting in dtr after the counter is started. use bfr to make a dtr setting. 2. 0% duty is specified by setting h'0000 in the duty register (dtr), and 100% duty is specified by setting buffer register (bfr) = cycle register (cylr). do not set bfr > cylr.
383 select counter clock 1 set port-atu connection 2 set cylr, bfr, dtr 3 start count 4 pwm waveform output start figure 10.60 sample setup procedure for pwm timer operation (channels 6 and 7)
384 sample setup procedure for event counter operation: an example of the setup procedure for event counter operation is shown in figure 10.61. 1. set the number of events to be counted in a general register (gr9a to gr9d). also, if necessary, an interrupt request can be sent to the cpu upon compare-match by making a setting in the timer interrupt enable register (tier). 2. set the port control register, corresponding to the port for signal input to the event counter, to atu event counter input. 3. select the event counter count edge with the egsel bits in the channel 9 timer control register (tcr9a to tcr9c). 4. input a signal to the event counter input pin. set number of events 1 set port-atu-ii connection 2 select counter clock 3 start event input 4 event counter operation start figure 10.61 sample setup procedure for event counter operation
385 sample setup procedure for channel 3 input capture triggered by channel 9 compare- match: an example of the setup procedure for compare-match signal transmission is shown in figure 10.62. 1. set the port control register, corresponding to the port for signal input to the event counter, to atu event counter input. 2. set the channel 3 timer i/o control register (tior3a, tior3b), and select the input capture disable setting for the general registers (gr3a to gr3d). input from pins tio3a to tio3d is masked. 3. select the event counter count edge with the egsel bits in the channel 9 timer control register (tcr9a, tcr9b), and set the trg3xen bit to 1. set the timing for capture in the general register (gr9a to gr9d). 4. set bit str3 to 1 in the timer start register (tstr) to start the channel 3 free-running counter (tcnt3). 5. input a signal to the event counter input pin. note: an interrupt request can be sent to the cpu upon channel 9 compare-match by making a setting in the timer interrupt enable register (tier), but an interrupt request cannot be sent to the cpu upon channel 3 input capture. set port-atu-ii connection 1 set input capture 2 start counter 4 start event input 5 select compare-match 3 input capture operation start figure 10.62 sample setup procedure for compare-match signal transmission
386 sample setup procedure for channel 10 missing-teeth detection: an example of the setup procedure for missing-teeth detection is shown in figure 10.63. 1. set port b control register h (pbcrh) or port l control register l (plcrl), corresponding to the port for input of the external signal (missing-teeth signal), to atu edge input (ti10). 2. set 1st-stage counter clock ? in prescaler register 4 (pscr4). set the external input (ti10) cycle multiplication factor with the pim bits in timer i/o control register 10 (tior10), and enable reload register 10c (rld10c) updating with the rlden bit. select the external input edge type with the ckeg bits in timer control register 10 (tcr10). 3. set general register 10g (gr10g) to the compare-match function with bit io10g in tior10. also, an interrupt request can be sent to the cpu upon compare-match by making a setting in interrupt enable register 10 (tier10). 4. set the timing for compare-match generation in gr10g according to the multiplication factor and number of missing-teeths in the missing-teeth interval set in step 1. 5. set the corresponding bit to 1 in timer start register 1 (tstr1) to start the channel 10 count. a compare-match occurs when the values in free-running counter 10g (tcnt10g) and gr10g match. note: the tcnt10g counter clock is generated according to the external input edge interval and multiplication factor selected in step 1, and the counter is cleared to h'0000 by an external input edge. set port-atu-ii connection 1 select counter clock 2 set missing-teeth timing 4 start counter 5 set compare-match 3 interrupt requests to cpu start figure 10.63 sample setup procedure for missing-teeth detection
387 10.7 usage notes note that the kinds of operation and contention described below occur during atu operation. contention between tcnt write and clearing by compare-match: with channel 3 to 7 free- running counters (tcnt3 to tcnt5, tcnt6a to tcnt6d, tcnt7a to tcnt7d), if a compare-match occurs in the t2 state of a cpu write cycle when counter clearing by compare- match has been set, or when pwm mode is used, the write to tcnt has priority and tcnt clearing is not performed. the compare-match remains valid, and writing of 1 to the interrupt status flag and waveform output to an external destination are performed in the same way as for a normal compare-match. the timing in this case is shown in figure 10.64. p t1 address tcnt address cpu write value internal write signal compare-match signal counter clear signal tcnt interrupt status flag external output signal (1 output) t2 figure 10.64 contention between tcnt write and clear
388 contention between tcnt write and increment: if a write to a channel 0 to 11 free-running counter (tcnt0, tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3 to tcnt5, tcnt6a to tcnt6d, tcnt7a to tcnt7d, tcnt10a to tcnt10h, tcnt11), down-counter (dcnt8a to dcnt8p), or event counter 9 (ecnt9a to ecnt9f) is performed while that counter is counting up or down, the write to the counter has priority and the counter is not incremented or decremented. the timing in this case is shown in figure 10.65 in this example, the cpu writes h'5555 at the point at which tcnt is to be incremented from h'1001 to h'1002. p t1 tcnt address 5555 (cpu write value) internal write signal tcnt input clock address tcnt t2 1001 5556 figure 10.65 contention between tcnt write and increment
389 contention between tcnt write and counter clearing by overflow: with channel 0 to 5 and 11 free-running counters (tcnt0, tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3 to tcnt5, tcnt11), if overflow occurs in the t2 state of a cpu write cycle, the write to tcnt has priority and tcnt is not cleared. writing of 1 to the interrupt status flag (ovf) due to the overflow is performed in the same way as for normal overflow. the timing in this case is shown in figure 10.66. in this example, h'5555 is written at the point at which tcnt overflows. p t1 tcnt address 5555 (cpu write value) internal write signal overflow signal interrupt status flag (ovf) tcnt input clock address tcnt t2 ffff 5556 figure 10.66 contention between tcnt write and overflow
390 contention between interrupt status flag setting by interrupt generation and clearing: if an event such as input capture/compare-match or overflow/underflow occurs in the t2 state of an interrupt status flag 0 write cycle by the cpu, zeroizing by the 0 write has priority and the interrupt status flag is cleared. the timing in this case is shown in figure 10.67. p t1 tsr address n + 1 n 0 written to tsr n internal write signal compare-match signal interrupt status flag imf address tcnt gr t2 tsr write cycle figure 10.67 contention between interrupt status flag setting by compare-match and clearing
391 contention between dtr write and bfr value transfer by buffer function: in channels 6 and 7, if there is contention between transfer of the buffer register (bfr) value to the corresponding duty register (dtr) due to a cycle register (cylr) compare-match, and a write to dtr by the cpu, the cpu write value is written to dtr. figure 10.68 shows an example in which contention arises when the bfr value is h'aaaa and the value to be written to dtr is h'5555. p dtr address h'5555 written to dtr h'aaaa h'5555 internal write signal compare-match signal address dtr bfr figure 10.68 contention between dtr write and bfr value transfer by buffer function
392 contention between interrupt status flag clearing by dmac and setting by input capture/compare-match: if a clear request signal is generated by the dmac when the interrupt status flag (icf0a to icf0d, cmf6a to cmf6d, cmf7a to cmf7d) is set by input capture (icr0a to icr0d) or compare-match (cylr6a to cylr6d, cylr7a to cylr7d), clearing by the dmac has priority and the interrupt status flag is not set. the timing in this case is shown in figure 10.69. p dmac clear request signal figure 10.69 contention between interrupt status flag clearing by dmac and setting by input capture/compare-match
393 halting of a down-counter by the cpu: a down-counter (dcnt) can be halted by writing h'0000 to it. the cpu cannot write 0 directly to the down-count start register (dstr); instead, by setting dcnt to h'0000, the corresponding dstr bit is cleared to 0 and the count is stopped. however, the osf bit in the timer status register (tsr) is set when dcnt underflows. note that when h'0000 is written to dcnt, the corresponding dstr bit is not cleared to 0 immediately; it is cleared to 0, and the down-counter is stopped, when underflow occurs following the h'0000 write. the timing in this case is shown in figure 10.70. p h'0000 written to dcnt h'0000 h'0000 n internal write signal dcnt dcnt input clock port output (one-shot pulse) tsr dstr figure 10.70 halting of a down-counter by the cpu
394 input capture operation when free-running counter is halted: in channels 0 to 5, channel 10, or channel 11, if input capture setting is performed and a trigger signal is input from the input pin, the tcnt value will be transferred to the corresponding general register (gr) or input capture register (icr) irrespective of whether the free-running counter (tcnt) is running or halted, and the imf or icf bit will be set in the timer status register (tsr). the timing in this case is shown in figure 10.71. p n internal input capture signal interrupt status flag imf (icf) timer status register tsr tcnt gr (icr) n figure 10.71 input capture operation before free-running counter is started
395 contention between dcnt write and counter clearing by underflow: with the channel 8 down-counters (dcnt8a to dcnt8p), if the count is halted due to underflow occurring in the t2 state of a down-counter write cycle by the cpu, retention of the h'0000 value has priority and the write to dcnt by the cpu is not performed. writing of 1 to the interrupt status flag (osf) when the underflow occurs is performed in the same way as for normal underflow. the timing in this case is shown in figure 10.72. in this example, a write of h'5555 to dcnt is attempted at the same time as dcnt underflows. p t1 dcnt address internal write signal dcnt input clock underflow signal address 5555 write data dcnt interrupt status flag (osf) t2 0000 0000 0001 h'0000 retained when dcnt halts figure 10.72 contention between dcnt write and underflow
396 contention between dstr bit setting by cpu and clearing by underflow: if underflow occurs in the t2 state of a down-counter start register (dstr) ??write cycle by the cpu, clearing to 0 by the underflow has priority, and the corresponding bit of dstr is not set to 1. the timing in this case is shown in figure 10.73. p t1 dstr address str write cycle 1 written to dstr internal write signal underflow signal address down-count start register t2 dcnt 0000 0000 0001 figure 10.73 contention between dstr bit setting by cpu and clearing by underflow
397 timing of prescaler register (pscr), timer control register (tcr), and timer mode register (tmdr) setting: settings in the prescaler register (pscr), timer control register (tcr), and timer mode register (tmdr) should be made before the counter is started. operation is not guaranteed if these registers are modified while the counter is running. also, the counter must not be started until p?has been input 32 times after setting pscr1 to pscr4. interrupt status flag clearing procedure: when an interrupt status flag is cleared to 0 by the cpu, it must first be read before 0 is written to it. correct operation cannot be guaranteed if 0 is written without first reading the flag. setting h'0000 in free-running counters 6a to 6d, 7a to 7d (tcnt6a to tcnt6d, tcnt7a to tcnt7d): if h'0000 is written to a channel 6 and 7 free-running counter (tcnt6a to tcnt6d, tcnt7a to tcnt7d), and the counter is started, the interval up to the first compare-match with the cycle register (cylr) and duty register (dtr) will be a maximum of one tcnt input clock cycle longer than the set value. with subsequent compare-matches, the correct waveform will be output for the cylr and dtr values. register values when a free-running counter (tcnt) halts: if the timer start register (tstr) value is set to 0 during counter operation, only incrementing of the corresponding free- running counter (tcnt) is stopped, and neither the free-running counter (tcnt) nor any other atu registers are initialized. the external output value at the time tstr is cleared to 0 will continue to be output. tcnt0 writing and interval timer operation: if the cpu program writes 1 to a bit in free- running counter 0 (tcnt0) corresponding to a bit set to 1 in the interval interrupt request register (itvrr) when that tcnt0 bit is 0, tcnt0 bit 6, 7, 8, 9, 10, 11, 12, or 13 will be detected as having changed from 0 to 1, and an interrupt request will be sent to intc and a/d sampling will be started. while the count is halted with the str0 bit cleared to 0 in timer start register 1 (tstr1), the bit transition from 0 to 1 will still be detected. automatic tsr clearing by dmac activation by the atu: automatic clearing of tsr is performed after completion of the transfer when the dmac is in burst mode, and each time the dmac returns the bus in cycle steal mode. interrupt status flag setting/resetting: with tsr, a 0 write to a bit is possible even if overlapping events occur for the same bit before writing 0 after reading 1 to clear that bit. (the duplicate events are not accepted.)
398 external output value in software standby mode: in software standby mode, the atu register and external output values are cleared to 0. however, while the channel 1, 2, and 11 tio1a to tio1h, tio2a to tio2h external output values are cleared to 0 immediately after software standby mode is exited, other external output values and all registers are cleared to 0 immediately after a transition to software standby mode. also, when pin output is inverted by the pin function controller's port b invert register (pbir) or port k invert register (pkir), the corresponding pins are cleared to 1. ck software standby mode other external outputs tio1a to 1h, tio2a to 2h, tio11a, 11b figure 10.74 external output value transition points in relation to software standby mode contention between tcnt clearing from channel 10 and tcnt overflow: when a channel 1 or 2 free-running counter (tcnt1a, tcnt1b, tcnt2a, tcnt2b) overflows, it is cleared to h'0000. if a clear signal from the channel 10 correction counter clear register (tcclr) is input at the same time, a 1 write to the interrupt status flag (ovf) due to the overflow is still performed in the same way as for a normal overflow. contention between channel 10 reload register transfer timing and write: if there is contention between a multiplied-output transfer from the input capture register (icr10a) to the channel 10 reload register (rldr10c), and the timing of a cpu write to that register, the cpu write has priority and the multiplied output is ignored. contention between channel 10 reload timing and write to tcnt10c: if there is contention between a multiplied-output transfer from the input capture register (icr10a) to the channel 10 reload register (rldr10c), and a cpu write to the reload counter (tcnt10c), the cpu write has priority and the multiplied output is ignored.
399 atu pin setting: when a port is set to the atu pin function, the following points must be noted. when using a port for input capture input, the corresponding tior register must be in the input capture disabled state when the port is set. regarding channel 10 ti10 input, tcr10 must be in the ti10 input disabled state when the port is set. when using a port for external clock input, the str bit for the corresponding channel must be in the count operation disabled state when the port is set. when using a port for event input, the corresponding tcr register must be in the count operation disabled state when the port is set. regarding tclkb and ti10 input, although input is assigned to a number of pins, when using tclkb and ti10 input, only one pin should be enabled. writing to rom area immediately after atu register write: if a write cycle for a rom address for which address bit 11 = 0 and address bit 12 = 1 (h'00001000 to h'000017ff, h'00003000 to h'000037ff, h'00005000 to h'000057ff, ..., h'0007f000 to h'0007f7ff, ..., h'000ff000 to h'000ff7ff) occurs immediately after an atu register write cycle, the value, or part of the value, written to rom will be written to the atu register. the following measures should be taken to prevent this. ? do not perform a cpu write to a rom address immediately after an atu register write cycle. for example, an instruction arrangement in which an mov instruction that writes to the atu is located at an even-word address (4n address), and is immediately followed by an mov instruction that writes to a rom area, will meet the bug conditions. ? do not perform an aud write to any of the above rom addresses immediately after an atu register write cycle. for example, in the case of a write to overlap ram when using the ram emulation function, the write should be performed to the on-chip ram area address, not the overlapping rom area address. ? do not perform a dmac write to an atu register when a rom address write operation occurs.
400 10.8 atu-ii registers and pins table 10.4 atu-ii registers and pins channel register name channel 0 channel 1 channel 2 channel 3 channel 4 channel 5 channel 6 channel 7 channel 8 channel 9 channel 10 channel 11 tstr (3) tstr1 tstr1 tstr1 tstr1 tstr1 tstr1 tstr2 tstr2 ?? tstr3 tstr1 pscr (4) pscr1 pscr1 pscr1 pscr1 pscr1 pscr1 pscr2 pscr3 pscr1 ? pscr4 pscr1 tcnt (25) tcnt0h, tcnt0l tcnt1a, tcnt1b tcnt2a, tcnt2b tcnt3 tcnt4 tcnt5 tcnt6a to tcnt6d tcnt7a to tcnt7d ?? tcnt10ah, tcnt10al, tcnt10b to tcnt10b tcnt11 dcnt (16) ? ? ? ?? ?? ? dcnt8a to dcnt8p ?? ? ecnt (6) ? ? ? ?? ?? ?? ecnt9a to ecnt9f ?? tcr (17) ? tcr1a, tcr1b tcr2a, tcr2b tcr3 tcr4 tcr5 tcr6a, tcr6b tcr7a, tcr7b tcr8 tcr9a to tcr9c tcr10 tcr11 tior (17) tior0 tior1a to tior1d tior2a to tior2d tior3a, tior3b tior4a, tior4b tior5a, tior5b ???? tior10 tior11 tsr (12) tsr0 tsr1a, tsr1b tsr2a, tsr2b tsr3 tsr6 tsr7 tsr8 tsr9 tsr10 tsr11 tier (12) tier0 tier1a, tier1b tier2a, tier2b tier3 tier6 tier7 tier8 tier9 tier10 tier11 itvrr (3) itvrr1, itvrr2a, itvrr2b ? ? ?? ?? ?? ? ? ? gr (37) ? gr1a to gr1h gr2a to gr2h gr3a to gr3d gr4a to gr4d gr5a to gr5d ??? gr9a to gr9f gr10g gr11a, gr11b icr (5) icr0ah, icr0al to icr0dh, icr0dl ? ? ?? ?? ?? ? icr10ah, icr10al ? ocr (11) ? ocr1 ocr2a to ocr2h ?? ?? ?? ? ocr10ah, ocr10al, ocr10b ? osbr (2) ? osbr1 osbr2 ?? ?? ?? ? ? ? trgmdr (1) ? trgmdr ????????? ? tmdr (1) ??? tmdr tmdr tmdr ????? ?
401 table 10.4 atu-ii registers and pins (cont) channel register name channel 0 channel 1 channel 2 channel 3 channel 4 channel 5 channel 6 channel 7 channel 8 channel 9 channel 10 channel 11 cylr (8) ?????? cylr6a to cylr6d cylr7a to cylr7d ??? ? bfr (8) ?????? bfr6a to bfr6d bfr7a to bfr7d ??? ? dtr (8) ?????? dtr6a to dtr7a dtr7a to dtr7d ??? ? pmdr (1) ?????? pmdr ???? ? pldr (1) ? ? ? ?? ?? ? rldr8 ?? ? tcnr (1) ? ? ? ?? ?? ? tcnr ?? ? otr (1) ? ? ? ?? ?? ? otr ?? ? dstr (1) ? ? ? ?? ?? ? dstr ?? ? rldenr (1) ? ? ? ?? ?? ? rldenr ?? ? rld (1) ? ? ? ?? ?? ?? ? rld10c ? ncr (1) ? ? ? ?? ?? ?? ? ncr10 ? tcclr (1) ? ? ? ?? ?? ?? ? tcclr10 ? pins * ti0a to d tio1a to d, tclka, tclkb tio2a to h, tclka, tclkb tio3a to d, tclka, tclkb tio4a to d, tclka, tclkb tio5a to d, tclka, tclkb to6a to d to7a to d to8a to p ti9a to f t10 tclka, tclkb note: * pin functions should be set as described in section 20, pin function controller (pfc).
402
403 section 11 advanced pulse controller (apc) 11.1 overview the sh7052f/sh7053f/sh7054f has an on-chip advanced pulse controller (apc) that can generate a maximum of eight pulse outputs, using the advanced timer unit ii (atu-ii) as the time base. 11.1.1 features the features of the apc are summarized below. ? maximum eight pulse outputs the pulse output pins can be selected from among eight pins. multiple settings are possible. ? output trigger provided by advanced timer unit ii (atu-ii) channel 2 pulse 0 output and 1 output is performed using the compare-match signal generated by the atu-ii channel ii compare-match register as the trigger.
404 11.1.2 block diagram figure 11.1 shows a block diagram of the advanced pulse controller. internal/external clock compare compare- match signal atu-ii popcr (pulse output port setting register) apc tcnt11 gr11a gr11b reset set reset set reset set reset set reset set reset set reset set reset set puls0 puls1 puls2 puls3 puls5 puls4 puls6 puls7 popcr: pulse output port control register bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 compare- match signal figure 11.1 advanced pulse controller block diagram
405 11.1.3 pin configuration table 11.1 summarizes the advanced pulse controller? output pins. table 11.1 advanced pulse controller pins pin name i/o function puls0 output apc pulse output 0 puls1 output apc pulse output 1 puls2 output apc pulse output 2 puls3 output apc pulse output 3 puls4 output apc pulse output 4 puls5 output apc pulse output 5 puls6 output apc pulse output 6 puls7 output apc pulse output 7 11.1.4 register configuration table 11.2 summarizes the advanced pulse controller? register. table 11.2 advanced pulse controller register name abbreviation r/w initial value address access size pulse output port control register popcr r/w h'0000 h'fffff700 8, 16 note: register access requires 4 or 5 cycles.
406 11.2 register descriptions 11.2.1 pulse output port control register (popcr) the pulse output port control register (popcr) is a 16-bit readable/writable register. popcr is initialized to h'0000 by a power-on reset and in hardware standby mode. it is not initialized in software standby mode. bit: 15 14 13 12 11 10 9 8 puls7 roe puls6 roe puls5 roe puls4 roe puls3 roe puls2 roe puls1 roe puls0 roe initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 puls7 soe puls6 soe puls5 soe puls4 soe puls3 soe puls2 soe puls1 soe puls0 soe initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 8?uls7 to puls0 reset output enable (puls7roe to puls0roe): these bits enable or disable 0 output to the apc pulse output pins (puls7 to puls0) bit by bit. bits 15 to 8: puls7roe to puls0roe description 0 0 output to apc pulse output pin (puls7 to puls0) is disabled (initial value) 1 0 output to apc pulse output pin (puls7 to puls0) is enabled when one of these bits is set to 1, 0 is output from the corresponding pin on a compare-match between the gr11b and tcnt11 values.
407 ? bits 7 to 0?uls7 to puls0 set output enable (puls7soe to puls0soe): these bits enable or disable 1 output to the apc pulse output pins (puls7 to puls0) bit by bit. bits 7 to 0: puls7soe to puls0soe description 0 1 output to apc pulse output pin (puls7 to puls0) is disabled (initial value) 1 1 output to apc pulse output pin (puls7 to puls0) is enabled when one of these bits is set to 1, 1 is output from the corresponding pin on a compare-match between the gr11a and tcnt11 values. 11.3 operation 11.3.1 overview apc pulse output is enabled by designating multiplex pins for apc pulse output with the pin function controller (pfc), and setting the corresponding bits to 1 in the pulse output port control register (popcr). when general register 11a (gr11a) in the advanced timer unit ii (atu-ii) subsequently generates a compare-match signal, 1 is output from the pins set to 1 by bits 7 to 0 in popcr. when general register 11b (gr11b) generates a compare-match signal, 0 is output from the pins set to 1 by bits 15 to 8 in popcr. 0 is output from the output-enabled state until the first compare-match occurs. the advanced pulse controller output operation is shown in figure 11.2.
408 cr port function selection upper 8 bits of popcr lower 8 bits of popcr reset signal set signal apc output pins (puls0 to puls7) compare-match signal compare-match signal gr11b griia figure 11.2 advanced pulse controller output operation 11.3.2 advanced pulse controller output operation example of setting procedure for advanced pulse controller output operation: figure 11.3 shows an example of the setting procedure for advanced pulse controller output operation. 1. set general registers gr11a and gr11b as output compare registers with the timer i/o control register (tior). 2. set the pulse rise point with gr11a and the pulse fall point with gr11b. 3. select the timer counter 11 (tcnt11) counter clock with the timer prescale register (pscr). tcnt11 can only be cleared by an overflow. 4. enable the respective interrupts with the timer interrupt enable register (tier). 5. set the pins for 1 output and 0 output with popcr. 6. set the control register for the port to be used by the apc to the apc output pin function. 7. set the str bit to 1 in the timer start register (tstr) to start timer counter 11 (tcnt11). 8. each time a compare-match interrupt is generated, update the gr value and set the next pulse output time. 9. each time a compare-match interrupt is generated, update the popcr value and set the next pin for pulse output.
409 gr function selection gr setting count operation setting interrupt request setting rise/fall port setting port output setting start count gr setting rise/fall port setting apc output operation compare-match? atu-ii settings port setting atu-ii setting atu-ii setting apc setting apc setting 1 2 3 4 5 6 7 8 9 no yes figure 11.3 example of setting procedure for advanced pulse controller output operation
410 example of advanced pulse controller output operation: figure 11.4 shows an example of advanced pulse controller output operation. 1. set atu-11 registers gr11a and gr11b (to be used for output trigger generation) as output compare registers. set the rise point in gr11a and the fall point in gr11b, and enable the respective compare-match interrupts. 2. write h'0101 to popcr. 3. start the atu timer 2 count. when a gr11a compare-match occurs, 1 is output from the puls0 pin. when a gr11b compare-match occurs, 0 is output from the puls0 pin. 4. pulse output widths and output pins can be continually changed by successively rewriting gr11a, gr11b, and popcr in response to compare-match interrupts. 5. by setting popcr to a value such as h'e0e0, pulses can be output from up to 8 pins in response to a single compare-match. gr11b gr11a h'0000 popcr puls0 puls1 puls2 puls3 puls4 puls5 puls6 puls7 tcnt value cleared on overflow e0e0 rewritten rewritten rewritten rewritten rewritten rewritten rewritten rewritten rewritten rewritten 0101 1010 0808 0404 0202 figure 11.4 example of advanced pulse controller output operation
411 11.4 usage notes contention between compare-match signals: if the same value is set for both gr11a and gr11b, and 0 output and 1 output are both enabled for the same pin by the popcr settings, 0 output has priority on pins puls0 to puls7 when compare-matches occur. h'8000 gr11a h'8000 h'ffff h'8000 gr11b h'0101 popcr puls0 pin tcnt value pin output is 0 figure 11.5 example of compare-match contention
412
413 section 12 watchdog timer (wdt) 12.1 overview the watchdog timer (wdt) is a 1-channel timer for monitoring system operations. if a system encounters a problem (crashes, for example) and the timer counter overflows without being rewritten correctly by the cpu, an overflow signal ( wdtovf ) is output externally. the wdt can simultaneously generate an internal reset signal for the entire chip. when the watchdog function is not needed, the wdt can be used as an interval timer. in the interval timer operation, an interval timer interrupt is generated at each counter overflow. the wdt is also used in recovering from standby mode. 12.1.1 features the wdt has the following features: ? works in watchdog timer mode or interval timer mode ? outputs wdtovf in watchdog timer mode when the counter overflows in watchdog timer mode, overflow signal wdtovf is output externally. it is possible to select whether to reset the chip internally when this happens. either the power-on reset or manual reset signal can be selected as the internal reset signal. ? generates interrupts in interval timer mode when the counter overflows, it generates an interval timer interrupt. ? clears software standby mode ? works with eight counter input clocks
414 12.1.2 block diagram figure 12.1 is the block diagram of the wdt. wdtovf figure 12.1 wdt block diagram 12.1.3 pin configuration table 12.1 shows the pin configuration. table 12.1 pin configuration pin abbreviation i/o function watchdog timer overflow wdtovf
415 12.1.4 register configuration table 12.2 summarizes the three wdt registers. they are used to select the clock, switch the wdt mode, and control the reset signal. table 12.2 wdt registers address name abbreviation r/w initial value write* 1 read* 2 timer control/status register tcsr r/(w)* 3 h'18 h'ffffec10 h'ffffec10 timer counter tcnt r/w h'00 h'ffffec11 reset control/status register rstcsr r/(w)* 3 h'1f h'ffffec12 h'ffffec13 notes: 1. write by word transfer. these registers cannot be written in byte or longword. 2. read by byte transfer. these registers cannot be read in word or longword. 3. only 0 can be written to bit 7 to clear the flag. 4. in register access, three cycles are required for both byte access and word access. 12.2 register descriptions 12.2.1 timer counter (tcnt) tcnt is an 8-bit readable/writable upcounter. (tcnt differs from other registers in that it is more difficult to write to. see section 12.2.4, register access, for details.) when the timer enable bit (tme) in the timer control/status register (tcsr) is set to 1, the watchdog timer counter starts counting pulses of an internal clock selected by clock select bits 2 to 0 (cks2 to cks0) in tcsr. when the value of tcnt overflows (changes from h'ff to h'00), a watchdog timer overflow signal ( wdtovf ) or interval timer interrupt (iti) is generated, depending on the mode selected in the wt/ it bit of tcsr. tcnt is initialized to h'00 by a power-on reset, in hardware and software standby modes, and when the tme bit is cleared to 0. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
416 12.2.2 timer control/status register (tcsr) the timer control/status register (tcsr) is an 8-bit readable/writable register. (tcsr differs from other registers in that it is more difficult to write to. see section 12.2.4, register access, for details.) tcsr performs selection of the timer counter (tcnt) input clock and mode. bits 7 to 5 are initialized to 000 by a power-on reset, and in hardware standby mode and software standby mode. bits 2 to 0 are initialized to 000 by a power-on reset and in hardware standby mode, but retain their values in software standby mode. bit: 7 6 5 4 3 2 1 0 ovf wt/ it ? bit 7?verflow flag (ovf): indicates that tcnt has overflowed from h'ff to h'00 in interval timer mode. this flag is not set in the watchdog timer mode. bit 7: ovf description 0 no overflow of tcnt in interval timer mode (initial value) [clearing condition] when 0 is written to ovf after reading ovf 1 tcnt overflow in interval timer mode ? bit 6?imer mode select (wt/ it ): selects whether to use the wdt as a watchdog timer or interval timer. when tcnt overflows, the wdt either generates an interval timer interrupt (iti) or generates a wdtovf signal, depending on the mode selected. bit 6: wt/ it description 0 interval timer mode: interval timer interrupt (iti) request to the cpu when tcnt overflows (initial value) 1 watchdog timer mode: wdtovf
417 ? bit 5?imer enable (tme): enables or disables the timer. bit 5: tme description 0 timer disabled: tcnt is initialized to h'00 and count-up stops (initial value) 1 timer enabled: tcnt starts counting. a wdtovf ? bits 4 and 3?eserved: these bits always read 1. the write value should always be 1. ? bits 2 to 0: clock select 2 to 0 (cks2 to cks0): these bits select one of eight internal clock sources for input to tcnt. the clock signals are obtained by dividing the frequency of the system clock ( ). description bit 2: cks2 bit 1: cks1 bit 0: cks0 clock source overflow interval* ( = 40 mhz) 00 0
418 12.2.3 reset control/status register (rstcsr) rstcsr is an 8-bit readable/writable register. (rstcsr differs from other registers in that it is more difficult to write. see section 12.2.4, register access, for details.) it controls output of the internal reset signal generated by timer counter (tcnt) overflow. rstcr is initialized to h'1f by input of a reset signal from the res pin, but is not initialized by the internal reset signal generated by overflow of the wdt. it is initialized to h'1f in hardware standby mode and software standby mode. bit: 7 6 5 4 3 2 1 0 wovf rste rsts initial value: 0 0 0 1 1 1 1 1 r/w: r/(w)* r/w r/w r r r r r note: only 0 can be written to bit 7 to clear the flag. ? bit 7?atchdog timer overflow flag (wovf): indicates that tcnt has overflowed (h'ff to h'00) in watchdog timer mode. this flag is not set in interval timer mode. bit 7: wovf description 0 no tcnt overflow in watchdog timer mode (initial value) [clearing condition] when 0 is written to wovf after reading wovf 1 set by tcnt overflow in watchdog timer mode ? bit 6?eset enable (rste): selects whether to reset the chip internally if tcnt overflows in watchdog timer mode. bit 6: rste description 0 not reset when tcnt overflows (initial value) lsi not reset internally, but tcnt and tcsr reset within wdt. 1 reset when tcnt overflows ? bit 5?eset select (rsts): selects the kind of internal reset to be generated when tcnt overflows in watchdog timer mode. bit 5: rsts description 0 power-on reset (initial value) 1 manual reset ? bits 4 to 0?eserved: these bits always read 1. the write value should always be 1.
419 12.2.4 register access the watchdog timer? tcnt, tcsr, and rstcsr registers differ from other registers in that they are more difficult to write to. the procedures for writing and reading these registers are given below. writing to tcnt and tcsr: these registers must be written by a word transfer instruction. they cannot be written by byte transfer instructions. tcnt and tcsr both have the same write address. the write data must be contained in the lower byte of the written word. the upper byte must be h'5a (for tcnt) or h'a5 (for tcsr) (figure 12.2). this transfers the write data from the lower byte to tcnt or tcsr. h'5a h'ffffec10 address: writing to tcnt 15 8 7 0 write data h'a5 h'ffffec10 address: writing to tcsr 15 8 7 0 write data figure 12.2 writing to tcnt and tcsr writing to rstcsr: rstcsr must be written by a word access to address h'ffffec12. it cannot be written by byte transfer instructions. procedures for writing 0 to wovf (bit 7) and for writing to rste (bit 6) and rsts (bit 5) are different, as shown in figure 12.3. to write 0 to the wovf bit, the write data must be h'a5 in the upper byte and h'00 in the lower byte. this clears the wovf bit to 0. the rste and rsts bits are not affected. to write to the rste and rsts bits, the upper byte must be h'5a and the lower byte must be the write data. the values of bits 6 and 5 of the lower byte are transferred to the rste and rsts bits, respectively. the wovf bit is not affected.
420 h'a5 h'ffffec12 address: writing 0 to the wovf bit 15 8 7 0 h'00 h'5a h'ffffec12 address: writing to the rste and rsts bits 15 8 7 0 write data figure 12.3 writing to rstcsr reading from tcnt, tcsr, and rstcsr: tcnt, tcsr, and rstcsr are read like other registers. use byte transfer instructions. the read addresses are h'ffffec10 for tcsr, h'ffffec11 for tcnt, and h'ffffec13 for rstcsr. 12.3 operation 12.3.1 watchdog timer mode to use the wdt as a watchdog timer, set the wt/ it and tme bits of tcsr to 1. software must prevent tcnt overflow by rewriting the tcnt value (normally by writing h'00) before overflow occurs. no tcnt overflows will occur while the system is operating normally, but if tcnt fails to be rewritten and overflows occur due to a system crash or the like, a wdtovf signal is output externally (figure 12.4). the wdtovf signal can be used to reset the system. the wdtovf signal is output for 128 clock cycles. if the rste bit in the reset control/status register (rstcsr) is set to 1, a signal that resets the chip internally will be generated at the same time as the wdtovf signal when tcnt overflows. either a power-on reset or a manual reset can be selected by the rsts bit in rstcsr. the internal reset signal is output for 512 clock cycles. when a wdt overflow reset is generated simultaneously with a reset input at the res pin, the res reset takes priority, and the wovf bit in rstcsr is cleared to 0. the following are not initialized by a wdt reset signal: ? pfc (pin function controller) registers ? i/o port registers these registers are initialized only by an external power-on reset.
421 h'ff h'00 overflow wt/ it = 1 tme = 1 h'00 written in tcnt internal reset signal* wdtovf signal tcnt value wdtovf and internal reset generated wovf = 1 wt/ it = 1 tme = 1 wt/ it : tme: timer mode select bit timer enable bit h'00 written in tcnt time 512 clocks 128 clocks note: * internal reset signal occurs only when the rste bit is set to 1. figure 12.4 operation in watchdog timer mode
422 12.3.2 interval timer mode to use the wdt as an interval timer, clear wt/ it to 0 and set tme to 1 in tcsr. an interval timer interrupt (iti) is generated each time the timer counter overflows. this function can be used to generate interval timer interrupts at regular intervals (figure 12.5). h'ff tcnt value iti: interval timer interrupt request generation h'00 wt/it = 0 tme = 1 iti iti iti iti time overflow overflow overflow overflow figure 12.5 operation in interval timer mode 12.3.3 clearing software standby mode the watchdog timer has a special function to clear software standby mode with an nmi interrupt. when using software standby mode, set the wdt as described below. before transition to software standby mode: the tme bit in tcsr must be cleared to 0 to stop the watchdog timer counter before entering software standby mode. the chip cannot enter software standby mode while the tme bit is set to 1. set bits cks2 to cks0 in tcsr so that the counter overflow interval is equal to or longer than the oscillation settling time. see section 24.3, ac characteristics, for the oscillation settling time. recovery from software standby mode: when an nmi request signal is received in software standby mode, the clock oscillator starts running and the watchdog timer starts incrementing at the rate selected by bits cks2 to cks0 before software standby mode was entered. when tcnt overflows (changes from h'ff to h'00), the clock is presumed to be stable and usable; clock signals are supplied to the entire chip and software standby mode ends. for details on software standby mode, see section 23, power-down state.
423 12.3.4 timing of setting the overflow flag (ovf) in interval timer mode, when tcnt overflows, the ovf flag of tcsr is set to 1 and an interval timer interrupt (iti) is simultaneously requested (figure 12.6). h'ff h'00 ck tcnt overflow signal (internal signal) ovf figure 12.6 timing of setting ovf 12.3.5 timing of setting the watchdog timer overflow flag (wovf) when tcnt overflows in watchdog timer mode, the wovf bit of rstcsr is set to 1 and a wdtovf signal is output. when the rste bit in rstcsr is set to 1, tcnt overflow enables an internal reset signal to be generated for the entire chip (figure 12.7). h'ff h'00 ck tcnt overflow signal (internal signal) wovf figure 12.7 timing of setting wovf
424 12.4 usage notes 12.4.1 tcnt write and increment contention if a timer counter increment clock pulse is generated during the t3 state of a write cycle to tcnt, the write takes priority and the timer counter is not incremented (figure 12.8). ck address internal write signal tcnt input clock tcnt nm tcnt address counter write data t1 t2 t3 tcnt write cycle figure 12.8 contention between tcnt write and increment 12.4.2 changing cks2 to cks0 bit values if the values of bits cks2 to cks0 in the timer control/status register (tcsr) are rewritten while the wdt is running, the count may not increment correctly. always stop the watchdog timer (by clearing the tme bit to 0) before changing the values of bits cks2 to cks0. 12.4.3 changing between watchdog timer/interval timer modes to prevent incorrect operation, always stop the watchdog timer (by clearing the tme bit to 0) before switching between interval timer mode and watchdog timer mode.
425 12.4.4 system reset by wdtovf signal if a wdtovf signal is input to the res pin, the chip cannot initialize correctly. avoid logical input of the wdtovf output signal to the res input pin. to reset the entire system with the wdtovf signal, use the circuit shown in figure 12.9. reset input reset signal to entire system sh7052f, sh7053f, sh7054f res wdtovf figure 12.9 example of system reset circuit using wdtovf signal 12.4.5 internal reset in watchdog timer mode if the rste bit is cleared to 0 in watchdog timer mode, the chip will not be reset internally when a tcnt overflow occurs, but tcnt and tcsr in the wdt will be reset. 12.4.6 manual reset in watchdog timer when an internal reset is effected by tcnt overflow in watchdog timer mode, the processor waits until the end of the bus cycle at the time of manual reset generation before making the transition to manual reset exception processing. therefore, the bus cycle is retained in a manual reset, but if a manual reset occurs while the bus is released or during dmac burst transfer, manual reset exception processing will be deferred until the cpu acquires the bus. however, if the interval from generation of the manual reset until the end of the bus cycle is equal to or longer than the internal manual reset interval of 512 cycles, the internal manual reset source is ignored instead of being deferred, and manual reset exception processing is not executed.
426
427 section 13 compare match timer (cmt) 13.1 overview the sh7052f/sh7053f/sh7054f has an on-chip compare match timer (cmt) comprising two 16-bit timer channels. the cmt has 16-bit counters and can generate interrupts at set intervals. 13.1.1 features the cmt has the following features: ? four types of counter input clock can be selected ? one of four internal clocks (p /8, p /32, p /128, p /512) can be selected independently for each channel. ? interrupt sources ? a compare match interrupt can be requested independently for each channel.
428 13.1.2 block diagram figure 13.1 shows a block diagram of the cmt. cm10 control circuit internal bus clock selection control circuit clock selection cmi1 p figure 13.1 cmt block diagram
429 13.1.3 register configuration table 13.1 summarizes the cmt register configuration. table 13.1 register configuration channel name abbreviation r/w initial value address access size (bits) shared compare match timer start register cmstr r/w h'0000 h'fffff710 8, 16, 32 0 compare match timer control/status register 0 cmcsr0 r/(w)* 1 h'0000 h'fffff712 8, 16, 32 compare match timer counter 0 cmcnt0 r/w h'0000 h'fffff714 8, 16, 32 compare match timer constant register 0 cmcor0 r/w h'ffff h'fffff716 8, 16, 32 1 compare match timer control/status register 1 cmcsr1 r/(w)* 1 h'0000 h'fffff718 8, 16, 32 compare match timer counter 1 cmcnt1 r/w h'0000 h'fffff71a 8, 16, 32 compare match timer constant register 1 cmcor1 r/w h'ffff h'fffff71c 8, 16, 32 notes: 1. the only value that can be written to the cmcsr0 and cmcsr1 cmf bits is a 0 to clear the flags. 2. with regard to access size, four or five cycles are required for byte access and word access, and eight or nine cycles for longword access.
430 13.2 register descriptions 13.2.1 compare match timer start register (cmstr) the compare match timer start register (cmstr) is a 16-bit register that selects whether to operate or halt the channel 0 and channel 1 counters (cmcnt). it is initialized to h'0000 by a power-on reset and in the standby modes. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 str1 str0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r/w r/w ? bits 15 to 2?eserved: these bits always read 0. the write value should always be 0. ? bit 1?ount start 1 (str1): selects whether to operate or halt compare match timer counter 1. bit 1: str1 description 0 cmcnt1 count operation halted (initial value) 1 cmcnt1 count operation ? bit 0?ount start 0 (str0): selects whether to operate or halt compare match timer counter 0. bit 0: str0 description 0 cmcnt0 count operation halted (initial value) 1 cmcnt0 count operation
431 13.2.2 compare match timer control/status register (cmcsr) the compare match timer control/status register (cmcsr) is a 16-bit register that indicates the occurrence of compare matches, sets the enable/disable status of interrupts, and establishes the clock used for incrementation. it is initialized to h'0000 by a power-on reset and in the standby modes. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 cmf cmie cks1 cks0 initial value: 0 0 0 0 0 0 0 0 r/w: r/(w)* r/w r r r r r/w r/w note: * the only value that can be written is a 0 to clear the flag. ? bits 15 to 8 and 5 to 2?eserved: these bits always read 0. the write value should always be 0. ? bit 7?ompare match flag (cmf): this flag indicates whether or not the cmcnt and cmcor values have matched. bit 7: cmf description 0 cmcnt and cmcor values have not matched (initial value) [clearing condition] write 0 to cmf after reading 1 from it 1 cmcnt and cmcor values have matched ? bit 6?ompare match interrupt enable (cmie): selects whether to enable or disable a compare match interrupt (cmi) when the cmcnt and cmcor values have matched (cmf = 1). bit 6: cmie description 0 compare match interrupt (cmi) disabled (initial value) 1 compare match interrupt (cmi) enabled
432 ? bits 1 and 0?lock select 1 and 0 (cks1, cks0): these bits select the clock input to cmcnt from among the four internal clocks obtained by dividing the peripheral clock (p ). when the str bit of cmstr is set to 1, cmcnt begins incrementing with the clock selected by cks1 and cks0. bit 1: cks1 bit 0: cks0 description 00p 13.2.3 compare match timer counter (cmcnt) the compare match timer counter (cmcnt) is a 16-bit register used as an up-counter for generating interrupt requests. when an internal clock is selected with the cks1 and cks0 bits of the cmcsr register and the str bit of cmstr is set to 1, cmcnt begins incrementing with that clock. when the cmcnt value matches that of the compare match timer constant register (cmcor), cmcnt is cleared to h'0000 and the cmf flag of cmcsr is set to 1. if the cmie bit of cmcsr is set to 1 at this time, a compare match interrupt (cmi) is requested. cmcnt is initialized to h'0000 by a power-on reset and in the standby modes. it is not initialized by a manual reset. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
433 13.2.4 compare match timer constant register (cmcor) the compare match timer constant register (cmcor) is a 16-bit register that sets the period for compare match with cmcnt. cmcor is initialized to h'ffff by a power-on reset and in the standby modes. it is not initialized by a manual reset. bit: 15 14 13 12 11 10 9 8 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 13.3 operation 13.3.1 cyclic count operation when an internal clock is selected with the cks1, cks0 bits of the cmcsr register and the str bit of cmstr is set to 1, cmcnt begins incrementing with the selected clock. when the cmcnt counter value matches that of the compare match constant register (cmcor), the cmcnt counter is cleared to h'0000 and the cmf flag of the cmcsr register is set to 1. if the cmie bit of the cmcsr register is set to 1 at this time, a compare match interrupt (cmi) is requested. the cmcnt counter begins counting up again from h'0000. figure 13.2 shows the compare match counter operation. cmcor h'0000 cmcnt value time counter cleared by cmcor compare match figure 13.2 counter operation
434 13.3.2 cmcnt count timing one of four clocks (p /8, p /32, p /128, p /512) obtained by dividing the peripheral clock (p ) can be selected by the cks1 and cks0 bits of cmcsr. figure 13.3 shows the timing. p n e 1 n n + 1 internal clock cmcnt input clock cmcnt figure 13.3 count timing 13.4 interrupts 13.4.1 interrupt sources and dtc activation the cmt has a compare match interrupt for each channel, with independent vector addresses allocated to each of them. the corresponding interrupt request is output when interrupt request flag cmf is set to 1 and interrupt enable bit cmie has also been set to 1. when activating cpu interrupts by interrupt request, the priority between the channels can be changed by means of interrupt controller settings. see section 6, interrupt controller, for details. 13.4.2 compare match flag set timing the cmf bit of the cmcsr register is set to 1 by the compare match signal generated when the cmcor register and the cmcnt counter match. the compare match signal is generated upon the final state of the match (timing at which the cmcnt counter matching count value is updated). consequently, after the cmcor register and the cmcnt counter match, a compare match signal will not be generated until a cmcnt counter input clock occurs. figure 13.4 shows the cmf bit set timing.
435 p cmcnt input clock cmcnt cmcor compare match signal cmf cmi n n 0 figure 13.4 cmf set timing 13.4.3 compare match flag clear timing the cmf bit of the cmcsr register is cleared by writing a 0 to it after reading a 1. figure 13.5 shows the timing when the cmf bit is cleared by the cpu. t2 t1 p cmf cmcsr write cycle figure 13.5 timing of cmf clear by the cpu
436 13.5 usage notes take care that the contentions described in sections 13.5.1 to 13.5.3 do not arise during cmt operation. 13.5.1 contention between cmcnt write and compare match if a compare match signal is generated during the t2 state of the cmcnt counter write cycle, the cmcnt counter clear has priority, so the write to the cmcnt counter is not performed. figure 13.6 shows the timing. t1 t2 p address internal write signal compare match signal cmcnt cmcnt write cycle cmcnt n h'0000 figure 13.6 cmcnt write and compare match contention
437 13.5.2 contention between cmcnt word write and incrementation if an increment occurs during the t2 state of the cmcnt counter word write cycle, the counter write has priority, so no increment occurs. figure 13.7 shows the timing. cmcnt write data t1 t2 p address internal write signal cmcnt input clock cmcnt cmcnt write cycle cmcnt nm figure 13.7 cmcnt word write and increment contention
438 13.5.3 contention between cmcnt byte write and incrementation if an increment occurs during the t2 state of the cmcnt byte write cycle, the counter write has priority, so no increment of the write data results on the side on which the write was performed. the byte data on the side on which writing was not performed is also not incremented, so the contents are those before the write. figure 13.8 shows the timing when an increment occurs during the t2 state of the cmcnth write cycle. t1 t2 p address internal write signal cmcnt input clock cmcnth cmcnt write cycle cmcnth n m cmcnth write data x x cmcntl figure 13.8 cmcnt byte write and increment contention
439 section 14 serial communication interface (sci) 14.1 overview the sh7052f/sh7053f/sh7054f has a serial communication interface (sci) with five independent channels. the sci supports both asynchronous and synchronous serial communication. it also has a multiprocessor communication function for serial communication between two or more processors, and a clock inverted input/output function. 14.1.1 features the sci has the following features: ? selection of asynchronous or synchronous as the serial communication mode ? asynchronous mode serial data communication is synchronized in character units. the sci can communicate with a universal asynchronous receiver/transmitter (uart), an asynchronous communication interface adapter (acia), or any other chip that employs standard asynchronous serial communication. it can also communicate with two or more other processors using the multiprocessor communication function. there are twelve selectable serial data communication formats. ? data length: seven or eight bits ? stop bit length: one or two bits ? parity: even, odd, or none ? multiprocessor bit: one or none ? receive error detection: parity, overrun, and framing errors ? break detection: by reading the rxd level directly when a framing error occurs ? synchronous mode serial data communication is synchronized with a clock signal. the sci can communicate with other chips having a synchronous communication function. there is one serial data communication format. ? data length: eight bits ? receive error detection: overrun errors ? serial clock inverted input/output ? full duplex communication: the transmitting and receiving sections are independent, so the sci can transmit and receive simultaneously. both sections use double buffering, so continuous data transfer is possible in both the transmit and receive directions. ? on-chip baud rate generator with selectable bit rates
440 ? internal or external transmit/receive clock source: baud rate generator (internal) or sck pin (external) ? four types of interrupts: transmit-data-empty, transmit-end, receive-data-full, and receive- error interrupts are requested independently. the transmit-data-empty and receive-data-full interrupts can start the direct memory access controller (dmac) to transfer data. ? selection of lsb-first or msb-first transfer (8-bit length) this selection is available regardless of the communication mode. (the descriptions in this section are based on lsb-first transfer.) 14.1.2 block diagram figure 14.1 shows a block diagram of the sci. parity generation parity check transmit/ receive control baud rate generator clock external clock bus interface internal data bus rxd rdr tdr rsr tsr ssr scr smr sdcr brr p figure 14.1 sci block diagram
441 14.1.3 pin configuration table 14.1 summarizes the sci pins by channel. table 14.1 sci pins channel pin name abbreviation input/output function 0 serial clock pin sck0 input/output sci0 clock input/output receive data pin rxd0 input sci0 receive data input transmit data pin txd0 output sci0 transmit data output 1 serial clock pin sck1 input/output sci1 clock input/output receive data pin rxd1 input sci1 receive data input transmit data pin txd1 output sci1 transmit data output 2 serial clock pin sck2 input/output sci2 clock input/output receive data pin rxd2 input sci2 receive data input transmit data pin txd2 output sci2 transmit data output 3 serial clock pin sck3 input/output sci3 clock input/output receive data pin rxd3 input sci3 receive data input transmit data pin txd3 output sci3 transmit data output 4 serial clock pin sck4 input/output sci4 clock input/output receive data pin rxd4 input sci4 receive data input transmit data pin txd4 output sci4 transmit data output note: in the text the pins are referred to as sck, rxd, and txd, omitting the channel number.
442 14.1.4 register configuration table 14.2 summarizes the sci internal registers. these registers select the communication mode (asynchronous or synchronous), specify the data format and bit rate, and control the transmitter and receiver sections. table 14.2 registers channel name abbreviation r/w initial value address* 2 access size 0 serial mode register 0 smr0 r/w h'00 h'fffff000 8, 16 bit rate register 0 brr0 r/w h'ff h'fffff001 serial control register 0 scr0 r/w h'00 h'fffff002 transmit data register 0 tdr0 r/w h'ff h'fffff003 serial status register 0 ssr0 r/(w)* 1 h'84 h'fffff004 receive data register 0 rdr0 r h'00 h'fffff005 serial direction control register 0 sdcr0 r/w h'f2 h'fffff006 8 1 serial mode register 1 smr1 r/w h'00 h'fffff008 8, 16 bit rate register 1 brr1 r/w h'ff h'fffff009 serial control register 1 scr1 r/w h'00 h'fffff00a transmit data register 1 tdr1 r/w h'ff h'fffff00b serial status register 1 ssr1 r/(w)* 1 h'84 h'fffff00c receive data register 1 rdr1 r h'00 h'fffff00d serial direction control register 1 sdcr1 r/w h'f2 h'fffff00e 8 2 serial mode register 2 smr2 r/w h'00 h'fffff010 8, 16 bit rate register 2 brr2 r/w h'ff h'fffff011 serial control register 2 scr2 r/w h'00 h'fffff012 transmit data register 2 tdr2 r/w h'ff h'fffff013 serial status register 2 ssr2 r/(w)* 1 h'84 h'fffff014 receive data register 2 rdr2 r h'00 h'fffff015 serial direction control register 2 sdcr2 r/w h'f2 h'fffff016 8
443 table 14.2 registers (cont) channel name abbreviation r/w initial value address* 2 access size 3 serial mode register 3 smr3 r/w h'00 h'fffff018 8, 16 bit rate register 3 brr3 r/w h'ff h'fffff019 serial control register 3 scr3 r/w h'00 h'fffff01a transmit data register 3 tdr3 r/w h'ff h'fffff01b serial status register 3 ssr3 r/(w)* 1 h'84 h'fffff01c receive data register 3 rdr3 r h'00 h'fffff01d serial direction control register 3 sdcr3 r/w h'f2 h'fffff01e 8 4 serial mode register 4 smr4 r/w h'00 h'fffff020 8, 16 bit rate register 4 brr4 r/w h'ff h'fffff021 serial control register 4 scr4 r/w h'00 h'fffff022 transmit data register 4 tdr4 r/w h'ff h'fffff023 serial status register 4 ssr4 r/(w)* 1 h'84 h'fffff024 receive data register 4 rdr4 r h'00 h'fffff025 serial direction control register 4 sdcr4 r/w h'f2 h'fffff026 8 notes: 1. the only value that can be written is a 0 to clear the flags. 2. do not access empty addresses. 3. in register access, four or five cycles are required for byte access, and eight or nine cycles for word access. 14.2 register descriptions 14.2.1 receive shift register (rsr) the receive shift register (rsr) receives serial data. data input at the rxd pin is loaded into rsr in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transferred to rdr. the cpu cannot read or write to rsr directly. bit: 7 6 5 4 3 2 1 0 r/w:
444 14.2.2 receive data register (rdr) the receive data register (rdr) stores serial receive data. the sci completes the reception of one byte of serial data by moving the received data from the receive shift register (rsr) into rdr for storage. rsr is then ready to receive the next data. this double buffering allows the sci to receive data continuously. the cpu can read but not write to rdr. rdr is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. it is not initialized by a manual reset. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r 14.2.3 transmit shift register (tsr) the transmit shift register (tsr) transmits serial data. the sci loads transmit data from the transmit data register (tdr) into tsr, then transmits the data serially from the txd pin, lsb (bit 0) first. after transmitting one data byte, the sci automatically loads the next transmit data from tdr into tsr and starts transmitting again. if the tdre bit of ssr is 1, however, the sci does not load the tdr contents into tsr. the cpu cannot read or write to tsr directly. bit: 7 6 5 4 3 2 1 0 r/w:
445 14.2.4 transmit data register (tdr) the transmit data register (tdr) is an 8-bit register that stores data for serial transmission. when the sci detects that the transmit shift register (tsr) is empty, it moves transmit data written in tdr into tsr and starts serial transmission. continuous serial transmission is possible by writing the next transmit data in tdr during serial transmission from tsr. the cpu can always read and write to tdr. tdr is initialized to h'ff by a power-on reset, and in hardware standby mode and software standby mode. it is not initialized by a manual reset. bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 14.2.5 serial mode register (smr) the serial mode register (smr) is an 8-bit register that specifies the sci serial communication format and selects the clock source for the baud rate generator. the cpu can always read and write to smr. smr is initialized to h'00 by a power-on reset and in hardware standby mode. it is not initialized by a manual reset, and in software standby mode. bit: 7 6 5 4 3 2 1 0 c/ a e ? bit 7?ommunication mode (c/ a ): selects whether the sci operates in asynchronous or synchronous mode. bit 7: c/ a description 0 asynchronous mode (initial value) 1 synchronous mode
446 ? bit 6?haracter length (chr): selects 7-bit or 8-bit data in asynchronous mode. in synchronous mode, the data length is always eight bits, regardless of the chr setting. bit 6: chr description 0 eight-bit data (initial value) 1 seven-bit data when 7-bit data is selected, the msb (bit 7) of the transmit data register is not transmitted. lsb-first/msb-first selection is not available. ? bit 5?arity enable (pe): selects whether to add a parity bit to transmit data and to check the parity of receive data, in asynchronous mode. in synchronous mode and when using a multiprocessor format, a parity bit is neither added nor checked, regardless of the pe bit setting. bit 5: pe description 0 parity bit not added or checked (initial value) 1 parity bit added and checked when pe is set to 1, an even or odd parity bit is added to transmit data, depending on the parity mode (o/ e e ? bit 4?arity mode (o/ e ): selects even or odd parity when parity bits are added and checked. the o/ e setting is used only in asynchronous mode and only when the parity enable bit (pe) is set to 1 to enable parity addition and checking. the o/ e setting is invalid in synchronous mode, in asynchronous mode when parity bit addition and checking is disabled, and when using a multiprocessor format. bit 4: o/ e description 0 even parity (initial value) if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. 1 odd parity if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined.
447 ? bit 3?top bit length (stop): selects one or two bits as the stop bit length in asynchronous mode. this setting is used only in asynchronous mode. it is ignored in synchronous mode because no stop bits are added. in receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of the next incoming character. bit 3: stop description 0 one stop bit (initial value) in transmitting, a single bit of 1 is added at the end of each transmitted character. 1 two stop bits in transmitting, two 1-bits are added at the end of each transmitted character. ? bit 2?ultiprocessor mode (mp): selects multiprocessor format. when multiprocessor format is selected, settings of the parity enable (pe) and parity mode (o/ e ) bits are ignored. the mp bit setting is used only in asynchronous mode; it is ignored in synchronous mode. for the multiprocessor communication function, see section 14.3.3, multiprocessor communication. bit 2: mp description 0 multiprocessor function disabled (initial value) 1 multiprocessor format selected ? bits 1 and 0?lock select 1 and 0 (cks1, cks0): these bits select the internal clock source of the on-chip baud rate generator. four clock sources are available: p , p /4, p /16, or p /64 (p is the peripheral clock). for further information on the clock source, bit rate register settings, and baud rate, see section 14.2.8, bit rate register. bit 1: cks1 bit 0: cks0 description 00p
448 14.2.6 serial control register (scr) the serial control register (scr) operates the sci transmitter/receiver, selects the serial clock output in asynchronous mode, enables/disables interrupt requests, and selects the transmit/receive clock source. the cpu can always read and write to scr. scr is initialized to h'00 by a power- on reset, and in hardware standby mode. it is not initialized by a manual reset, and in software standby mode. bit: 7 6 5 4 3 2 1 0 tie rie te re mpie teie cke1 cke0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bit 7?ransmit interrupt enable (tie): enables or disables the transmit-data-empty interrupt (txi) requested when the transmit data register empty bit (tdre) in the serial status register (ssr) is set to 1 by transfer of serial transmit data from tdr to tsr. bit 7: tie description 0 transmit-data-empty interrupt request (txi) is disabled (initial value) the txi interrupt request can be cleared by reading tdre after it has been set to 1, then clearing tdre to 0, or by clearing tie to 0. 1 transmit-data-empty interrupt request (txi) is enabled ? bit 6?eceive interrupt enable (rie): enables or disables the receive-data-full interrupt (rxi) requested when the receive data register full bit (rdrf) in the serial status register (ssr) is set to 1 by transfer of serial receive data from rsr to rdr. it also enables or disables receive-error interrupt (eri) requests. bit 6: rie description 0 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are disabled (initial value) rxi and eri interrupt requests can be cleared by reading the rdrf flag or error flag (fer, per, or orer) after it has been set to 1, then clearing the flag to 0, or by clearing rie to 0. 1 receive-data-full interrupt (rxi) and receive-error interrupt (eri) requests are enabled
449 ? bit 5?ransmit enable (te): enables or disables the sci serial transmitter. bit 5: te description 0 transmitter disabled (initial value) the transmit data register empty bit (tdre) in the serial status register (ssr) is locked at 1. 1 transmitter enabled serial transmission starts when the transmit data register empty (tdre) bit in the serial status register (ssr) is cleared to 0 after writing of transmit data into tdr. select the transmit format in smr before setting te to 1. ? bit 4?eceive enable (re): enables or disables the sci serial receiver. bit 4: re description 0 receiver disabled (initial value) clearing re to 0 does not affect the receive flags (rdrf, fer, per, orer). these flags retain their previous values. 1 receiver enabled serial reception starts when a start bit is detected in asynchronous mode, or synchronous clock input is detected in synchronous mode. select the receive format in smr before setting re to 1.
450 ? bit 3?ultiprocessor interrupt enable (mpie): enables or disables multiprocessor interrupts. the mpie setting is used only in asynchronous mode, and only if the multiprocessor mode bit (mp) in the serial mode register (smr) is set to 1 during reception. the mpie setting is ignored in synchronous mode or when the mp bit is cleared to 0. bit 3: mpie description 0 multiprocessor interrupts are disabled (normal receive operation) (initial value) [clearing conditions] ? ? ? bit 2?ransmit-end interrupt enable (teie): enables or disables the transmit-end interrupt (tei) requested if tdr does not contain valid transmit data when the msb is transmitted. bit 2: teie description 0 transmit-end interrupt (tei) requests are disabled* (initial value) 1 transmit-end interrupt (tei) requests are enabled* note: * the tei request can be cleared by reading the tdre bit in the serial status register (ssr) after it has been set to 1, then clearing tdre to 0 and clearing the transmit end (tend) bit to 0; or by clearing the teie bit to 0.
451 ? bits 1 and 0?lock enable 1 and 0 (cke1, cke0): these bits select the sci clock source and enable or disable clock output from the sck pin. depending on the combination of cke1 and cke0, the sck pin can be used for serial clock output, or serial clock input. select the sck pin function by using the pin function controller (pfc). the cke0 setting is valid only in asynchronous mode, and only when the sci is internally clocked (cke1 = 0). the cke0 setting is ignored in synchronous mode, or when an external clock source is selected (cke1 = 1). for further details on selection of the sci clock source, see table 14.9 in section 14.3, operation. bit 1: cke1 bit 0: cke0 description* 1 0 0 asynchronous mode internal clock, sck pin used for input pin (input signal is ignored) or output pin (output level is undefined)* 2 synchronous mode internal clock, sck pin used for synchronous clock output *2 0 1 asynchronous mode internal clock, sck pin used for clock output* 3 synchronous mode internal clock, sck pin used for synchronous clock output 1 0 asynchronous mode external clock, sck pin used for clock input* 4 synchronous mode external clock, sck pin used for synchronous clock input 1 1 asynchronous mode external clock, sck pin used for clock input* 4 synchronous mode external clock, sck pin used for synchronous clock input notes: 1. the sck pin is multiplexed with other functions. use the pin function controller (pfc) to select the sck function for this pin, as well as the i/o direction. 2. initial value. 3. the output clock frequency is the same as the bit rate. 4. the input clock frequency is 16 times the bit rate.
452 14.2.7 serial status register (ssr) the serial status register (ssr) is an 8-bit register containing multiprocessor bit values, and status flags that indicate the sci operating status. the cpu can always read and write to ssr, but cannot write 1 in the status flags (tdre, rdrf, orer, per, and fer). these flags can be cleared to 0 only if they have first been read (after being set to 1). bits 2 (tend) and 1 (mpb) are read-only bits that cannot be written. ssr is initialized to h'84 by a power-on reset, and in hardware standby mode and software standby mode. it is not initialized by a manual reset. bit: 7 6 5 4 3 2 1 0 tdre rdrf orer fer per tend mpb mpbt initial value: 1 0 0 0 0 1 0 0 r/w: r/(w)* r/(w)* r/(w)* r/(w)* r/(w)* r r r/w note: * the only value that can be written is a 0 to clear the flag. ? bit 7?ransmit data register empty (tdre): indicates that the sci has loaded transmit data from tdr into tsr and new serial transmit data can be written in tdr. bit 7: tdre description 0 tdr contains valid transmit data [clearing conditions] ? ? ? ? ?
453 ? bit 6?eceive data register full (rdrf): indicates that rdr contains received data. bit 6: rdrf description 0 rdr does not contain valid receive data (initial value) [clearing conditions] ? ? ? ? bit 5?verrun error (orer): indicates that data reception ended abnormally due to an overrun error. bit 5: orer description 0 receiving is in progress or has ended normally (initial value) clearing the re bit to 0 in the serial control register does not affect the orer bit, which retains its previous value. [clearing conditions] ? ?
454 ? bit 4?raming error (fer): indicates that data reception ended abnormally due to a framing error in asynchronous mode. bit 4: fer description 0 receiving is in progress or has ended normally (initial value) clearing the re bit to 0 in the serial control register does not affect the fer bit, which retains its previous value. [clearing conditions] ? ? ? bit 3?arity error (per): indicates that data reception (with parity) ended abnormally due to a parity error in asynchronous mode. bit 3: per description 0 receiving is in progress or has ended normally (initial value) clearing the re bit to 0 in the serial control register does not affect the per bit, which retains its previous value. [clearing conditions] ? ? e
455 ? bit 2?ransmit end (tend): indicates that when the last bit of a serial character was transmitted, tdr did not contain valid data, so transmission has ended. tend is a read-only bit and cannot be written. bit 2: tend description 0 transmission is in progress [clearing conditions] ? ? ? ? ? ? bit 1?ultiprocessor bit (mpb): stores the value of the multiprocessor bit in receive data when a multiprocessor format is selected for receiving in asynchronous mode. mpb is a read- only bit and cannot be written. bit 1: mpb description 0 multiprocessor bit value in receive data is 0 (initial value) if re is cleared to 0 when a multiprocessor format is selected, the mpb retains its previous value. 1 multiprocessor bit value in receive data is 1 ? bit 0?ultiprocessor bit transfer (mpbt): stores the value of the multiprocessor bit added to transmit data when a multiprocessor format is selected for transmitting in asynchronous mode. the mpbt setting is ignored in synchronous mode, when a multiprocessor format is not selected, or when the sci is not transmitting. bit 0: mpbt description 0 multiprocessor bit value in transmit data is 0 (initial value) 1 multiprocessor bit value in transmit data is 1
456 14.2.8 bit rate register (brr) the bit rate register (brr) is an 8-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in the serial mode register (smr), determines the serial transmit/receive bit rate. the cpu can always read and write to brr. brr is initialized to h'ff by a power-on reset and in hardware standby mode. it is not initialized by a manual reset, and in software standby mode. each channel has independent baud rate generator control, so different values can be set for each channel. bit: 7 6 5 4 3 2 1 0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w table 14.3 lists examples of brr settings in the asynchronous mode; table 14.4 lists examples of bbr settings in the clock synchronous mode. the brr setting is calculated as follows: asynchronous mode: n = 64 synchronous mode: n = 8 smr settings n clock source cks1 cks2 0p
457 the bit rate error in asynchronous mode is calculated as follows: error (%) = 1 ? ? ? ? ? ? table 14.3 bit rates and brr settings in asynchronous mode p (mhz) bit rate 10 11.0592 12 (bits/s) n n error (%) n n error (%) n n error (%) 110 2 177 e 0.25 2 195 0.19 2 212 0.03 150 2 129 0.16 2 143 0.00 2 155 0.16 300 2 64 0.16 2 71 0.00 2 77 0.16 600 1 129 0.16 1 143 0.00 1 155 0.16 1200 1 64 0.16 1 71 0.00 1 77 0.16 2400 0 129 0.16 0 143 0.00 0 155 0.16 4800 0 64 0.16 0 71 0.00 0 77 0.16 9600 0 32 e 1.36 0 35 0.00 0 28 0.16 14400 0 21 e 1.36 0 23 0.00 0 25 0.16 19200 0 15 1.73 0 19 0.00 0 19 e 2.34 28800 0 10 e 1.36 0 11 0.00 0 12 0.16 31250 0 9 0.00 0 10 0.54 0 11 0.00 38400 0 7 1.73 0 8 0.00 0 9 e 2.34
458 table 14.3 bit rates and brr settings in asynchronous mode (cont) p (mhz) bit rate 12.288 14 14.7456 (bits/s) n n error (%) n n error (%) n n error (%) 110 2 217 0.08 2 248 e 0.17 3 64 0.70 150 2 159 0.00 2 181 0.16 2 191 0.00 300 2 79 0.00 2 90 0.16 2 95 0.00 600 1 159 0.00 1 181 0.16 1 191 0.00 1200 1 79 0.00 1 90 0.16 1 95 0.00 2400 0 159 0.00 0 181 0.16 0 191 0.00 4800 0 79 0.00 0 90 0.16 0 95 0.00 9600 0 39 0.00 0 45 e 0.93 0 47 0.00 14400 0 26 e 1.23 0 29 1.27 0 31 0.00 19200 0 19 0.00 0 22 e 0.93 0 23 0.00 28800 0 12 2.56 0 14 1.27 0 15 0.00 31250 0 11 2.40 0 13 0.00 0 14 e 1.70 38400 0 9 0.00 0 10 3.57 0 11 0.00
459 table 14.3 bit rates and brr settings in asynchronous mode (cont) p (mhz) bit rate 16 17.2032 18 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 70 0.03 3 75 0.48 3 79 e 0.12 150 2 207 0.16 2 223 0.00 2 233 0.16 300 2 103 0.16 2 111 0.00 2 116 0.16 600 1 207 0.16 1 223 0.00 1 233 0.16 1200 1 103 0.16 1 111 0.00 1 116 0.16 2400 0 207 0.16 0 223 0.00 0 233 0.16 4800 0 103 0.16 0 111 0.00 0 116 0.16 9600 0 51 0.16 0 55 0.00 0 58 e 0.69 14400 0 34 e 0.79 0 36 0.90 0 38 0.16 19200 0 25 0.16 0 27 0.00 0 28 1.02 28800 0 16 2.12 0 18 e 1.75 0 19 e 2.34 31250 0 15 0.00 0 16 1.20 0 17 0.00 38400 0 12 0.16 0 13 0.00 0 14 e 2.34
460 table 14.3 bit rates and brr settings in asynchronous mode (cont) (mhz) bit rate 18.432 19.6608 20 (bits/s) n n error (%) n n error (%) n n error (%) 110 3 81 e 0.22 3 86 0.31 3 88 e 0.25 150 2 239 0.00 2 255 0.00 3 64 0.16 300 2 119 0.00 2 127 0.00 2 129 0.16 600 1 239 0.00 1 255 0.00 2 64 0.16 1200 1 119 0.00 1 127 0.00 1 129 0.16 2400 0 239 0.00 0 255 0.00 1 64 0.16 4800 0 119 0.00 0 127 0.00 0 129 0.16 9600 0 59 0.00 0 63 0.00 0 64 0.16 14400 0 39 0.00 0 42 e 0.78 0 42 0.94 19200 0 29 0.00 0 31 0.00 0 32 e 1.36 28800 0 19 0.00 0 20 1.59 0 21 e 1.36 31250 0 17 2.40 0 19 e 1.70 0 19 0.00 38400 0 14 0.00 0 15 0.00 0 15 1.73
461 table 14.4 bit rates and brr settings in synchronous mode p (mhz) bit rate 10 12 16 20 (bits/s) n n n n n n n n 250 ?? 3 187 3 249 500 ?? 3 93 3 124 ?? 1 k ?? 2 187 2 249 ?? 2.5 k 1 249 2 74 2 99 2 124 5 k 1 124 1 149 1 199 2 249 10 k 0 249 1 74 1 99 1 124 25 k 0 99 0 119 0 159 1 199 50 k 0 49 0 59 0 79 0 99 100 k 0 24 0 29 0 39 0 49 250 k 0 9 0 11 0 15 0 19 500 k 0 4 0 5 0 7 0 9 1 m 020304 2.5 m 0 0* 0 0* ?? 01 5 m 00* note: settings with an error of 1% or less are recommended. legend blank: no setting available ? : setting possible, but error occurs *: continuous transmission/reception not possible table 14.5 indicates the maximum bit rates in asynchronous mode when the baud rate generator is being used for various frequencies. tables 14.6 and 14.7 show the maximum rates for external clock input.
462 table 14.5 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) settings p (mhz) maximum bit rate (bits/s) n n 10 312500 0 0 11.0592 345600 0 0 12 375000 0 0 12.288 384000 0 0 14 437500 0 0 14.7456 460800 0 0 16 500000 0 0 17.2032 537600 0 0 18 562500 0 0 18.432 576000 0 0 19.6608 614400 0 0 20 625000 0 0 table 14.6 maximum bit rates during external clock input (asynchronous mode) p (mhz) external input clock (mhz) maximum bit rate (bits/s) 10 2.5000 156250 11.0592 2.7648 172800 12 3.0000 187500 12.288 3.0720 192000 14 3.5000 218750 14.7456 3.6864 230400 16 4.0000 250000 17.2032 4.3008 268800 18 4.5000 281250 18.432 4.6080 288000 19.6608 4.9152 307200 20 5.0000 312500
463 table 14.7 maximum bit rates during external clock input (clock synchronous mode) p (mhz) external input clock (mhz) maximum bit rate (bits/s) 10 1.6667 1666666.7 12 2.0000 2000000.0 14 2.3333 2333333.3 16 2.6667 2666666.7 18 3.0000 3000000.0 20 3.3333 3333333.3 14.2.9 serial direction control register (sdcr) bit: 7 6 5 4 3 2 1 0 ???? dir ??? initial value: 1 1 1 1 0 0 1 0 r/w: r r r r r/w r r r the dir bit in the serial direction control register (sdcr) selects lsb-first or msb-first transfer. with an 8-bit data length, lsb-first/msb-first selection is available regardless of the communication mode. with a 7-bit data length, lsb-first transfer must be selected. the description in this section assumes lsb-first transfer. sdcr is initialized to h'f2 by a power-on reset and in the hardware standby mode. it is not initialized by a manual reset, and in software standby mode. ? bits 7 to 4?eserved: the write value must always be 1. operation cannot be guaranteed if 0 is written. ? bit 3?ata transfer direction (dir): selects the serial/parallel conversion format. valid for an 8-bit transmit/receive format. bit 3: dir description 0 tdr contents are transmitted in lsb-first order (initial value) receive data is stored in rdr in lsb-first order 1 tdr contents are transmitted in msb-first order receive data is stored in rdr in msb-first order ? bit 2?eserved: this bit always reads 0. operation cannot be guaranteed if 1 is written. ? bit 1?eserved: this bit always reads 1, and cannot be modified.
464 ? bit 0?eserved: this bit always reads 0. operation cannot be guaranteed if 1 is written. 14.2.10 inversion of sck pin signal the signal input from the sck pin and the signal output from the sck pin can be inverted by means of a port control register setting. see the section on port function control for details. 14.3 operation 14.3.1 overview for serial communication, the sci has an asynchronous mode in which characters are synchronized individually, and a synchronous mode in which communication is synchronized with clock pulses. selection of asynchronous or synchronous mode and the transmission format is made in the serial mode register (smr) as shown in table 14.8. the sci clock source is selected by the c/ a bit in the serial mode register (smr) and the cke1 and cke0 bits in the serial control register (scr), as shown in table 14.9. asynchronous mode: ? data length is selectable: seven or eight bits. ? parity and multiprocessor bits are selectable, as well as the stop bit length (one or two bits). these selections determine the transmit/receive format and character length. ? in receiving, it is possible to detect framing errors (fer), parity errors (per), overrun errors (orer), and the break state. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator clock, and can output a clock with a frequency matching the bit rate. ? when an external clock is selected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) synchronous mode: ? the communication format has a fixed 8-bit data length. ? in receiving, it is possible to detect overrun errors (orer). ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates using the on-chip baud rate generator clock, and outputs a serial clock signal to external devices. ? when an external clock is selected, the sci operates on the input serial clock. the on-chip baud rate generator is not used.
465 table 14.8 serial mode register settings and sci communication formats smr settings sci communication format mode bit 7 c/ a bit 6 chr bit 5 pe bit 2 mp bit 3 stop data length parity bit multipro- cessor bit stop bit length asynchronous 00000 8-bit absent absent 1 bit 1 2 bits 1 0 present 1 bit 1 2 bits 1 0 0 7-bit absent 1 bit 1 2 bits 1 0 present 1 bit 1 2 bits asynchronous 0 * 1 0 8-bit absent present 1 bit (multiprocessor * 1 2 bits format) 1 * 0 7-bit 1 bit * 1 2 bits synchronous 1 **** 8-bit absent none note: asterisks (*) in the table indicate don ? t care bits. table 14.9 smr and scr settings and sci clock source selection smr scr settings sci transmit/receive clock mode bit 7 c/ a bit 1 cke1 bit 0 cke0 clock source sck pin function* asynchronous 0 0 0 internal sci does not use the sck pin 1 outputs a clock with frequency matching the bit rate 1 0 external inputs a clock with frequency 16 times the bit rate 1 synchronous 1 0 0 internal outputs the serial clock 1 or the inverted serial clock 1 0 external inputs the serial clock 1 or the inverted serial clock note: * select the function in combination with the pin function controller (pfc).
466 14.3.2 operation in asynchronous mode in asynchronous mode, each transmitted or received character begins with a start bit and ends with a stop bit. serial communication is synchronized one character at a time. the transmitting and receiving sections of the sci are independent, so full duplex communication is possible. the transmitter and receiver are both double buffered, so data can be written and read while transmitting and receiving are in progress, enabling continuous transmitting and receiving. figure 14.2 shows the general format of asynchronous serial communication. in asynchronous serial communication, the communication line is normally held in the marking (high) state. the sci monitors the line and starts serial communication when the line goes to the space (low) state, indicating a start bit. one serial character consists of a start bit (low), data (lsb first), parity bit (high or low), and stop bit (high), in that order. when receiving in asynchronous mode, the sci synchronizes on the falling edge of the start bit. the sci samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit rate. receive data is latched at the center of each bit. 0 d0d1d2d3d4d5d6d7 1 1 0/1 1 1 (lsb) (msb) serial data start bit 1 bit transmit/receive data 7 or 8 bits one unit of communication data (character or frame) idling (marking) parity bit stop bit 1 or no bit 1 or 2 bits figure 14.2 data format in asynchronous communication (example: 8-bit data with parity and two stop bits)
467 transmit/receive formats: table 14.10 shows the 12 communication formats that can be selected in asynchronous mode. the format is selected by settings in the serial mode register (smr). table 14.10 serial communication formats (asynchronous mode) smr bits serial transmit/receive format and frame length chr pe mp stop 1 2345678 9 10 11 12 0 0 0 0 start 8-bit data stop 0 0 0 1 start 8-bit data stop stop 0 1 0 0 start 8-bit data p stop 0 1 0 1 start 8-bit data p stop stop 1 0 0 0 start 7-bit data stop 1 0 0 1 start 7-bit data stop stop 1 1 0 0 start 7-bit data p stop 1 1 0 1 start 7-bit data p stop stop 0 ? 1 0 start 8-bit data mpb stop 0 ? 1 1 start 8-bit data mpb stop stop 1 ? 1 0 start 7-bit data mpb stop 1 ? 1 1 start 7-bit data mpb stop stop ? : don ? t care bits. start: start bit stop: stop bit p: parity bit mpb: multiprocessor bit clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in the serial mode register (smr) and bits cke1 and cke0 in the serial control register (scr) (table 14.9). when an external clock is input at the sck pin, it must have a frequency equal to 16 times the desired bit rate.
468 when the sci operates on an internal clock, it can output a clock signal at the sck pin. the frequency of this output clock is equal to the bit rate. the phase is aligned as in figure 14.3 so that the rising edge of the clock occurs at the center of each transmit data bit. 0 d0d1d2d3d4d5d6d70/1 1 1 1 frame figure 14.3 output clock and communication data phase relationship (asynchronous mode) data transmit/receive operation sci initialization (asynchronous mode): before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scr), then initialize the sci as follows. when changing the operation mode or communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 sets tdre to 1 and initializes the transmit shift register (tsr). clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags and receive data register (rdr), which retain their previous contents. when an external clock is used, the clock should not be stopped during initialization or subsequent operation. sci operation becomes unreliable if the clock is stopped. figure 14.4 is a sample flowchart for initializing the sci. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. select the clock source in the serial control register (scr). leave rie, tie, teie, mpie, te and re cleared to 0. if clock output is selected in asynchronous mode, clock output starts immediately after the setting is made in scr. 2. select the communication format in the serial mode register (smr) and serial direction control register (sdcr). 3. write the value corresponding to the bit rate in the bit rate register (brr) (unless an external clock is used). 4. wait for at least the interval required to transmit or receive one bit, then set te or re in the serial control register (scr) to 1.* also set rie, tie, teie and mpie as necessary. setting te or re enables the sci to use the txd or rxd pin. note: * in simultaneous transmit/receive operation, the te bit and re bit must be cleared to 0 or set to 1 simultaneously.
469 initialization clear te and re bits to 0 in scr set value in brr set transmit/receive format in smr (te and re bits cleared to 0) select transmit/receive format in smr and sdcr set te or re to 1 in scr; set rie, tie, teie, and mpie as necessary 1-bit interval elapsed? end 3 1 2 4 no wait yes figure 14.4 sample flowchart for sci initialization transmitting serial data (asynchronous mode): figure 14.5 shows a sample flowchart for transmitting serial data. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the txd pin using the pfc. 2. sci status check and transmit data write: read the serial status register (ssr), check that the tdre bit is 1, then write transmit data in the transmit data register (tdr) and clear tdre to 0. 3. continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in tdr, then clear tdre to 0. when the dmac is started by a transmit-data-empty interrupt request (txi) in order to write data in tdr, the tdre bit is checked and cleared automatically. 4. to output a break at the end of serial transmission, first clear the port data register (dr) to 0, then clear the te bit to 0 in scr and use the pfc to establish the txd pin as an output port.
470 start of transmission initialization read tdre bit in ssr read tend bit in ssr clear te bit in scr to 0; select thetxd pin as an output port with the pfc tend = 1? end of transmission 1 2 3 no yes tdre = 1? write transmit data to tdr and clear tdre bit in ssr to 0 all data transmitted? no yes output break signal? no yes clear port dr to 0 4 yes no figure 14.5 sample flowchart for transmitting serial data
471 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in ssr. when tdre is cleared to 0, the sci recognizes that the transmit data register (tdr) contains new data, and loads this data from tdr into the transmit shift register (tsr). 2. after loading the data from tdr into tsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) is set to 1 in scr, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd pin: a. start bit: one 0-bit is output. b. transmit data: seven or eight bits of data are output, lsb first. c. parity bit or multiprocessor bit: one parity bit (even or odd parity) or one multiprocessor bit is output. formats in which neither a parity bit nor a multiprocessor bit is output can also be selected. d. stop bit: one or two 1-bits (stop bits) are output. e. marking: output of 1-bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads new data from tdr into tsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit to 1 in ssr, outputs the stop bit, then continues output of 1-bits (marking). if the transmit-end interrupt enable bit (teie) in scr is set to 1, a transmit-end interrupt (tei) is requested. figure 14.6 shows an example of sci transmit operation in asynchronous mode.
472 01 1 1 0/1 0 1 tdre tend parity bit parity bit serial data start bit data stop bit start bit data stop bit idling (marking) txi interrupt request txi interrupt handler writes data in tdr and clears tdre to 0 txi interrupt request tei interrupt request 1 frame d0 d1 d7 d0 d1 d7 0/1 figure 14.6 sci transmit operation in asynchronous mode (example: 8-bit data with parity and one stop bit) receiving serial data (asynchronous mode): figures 14.7 and 14.8 show a sample flowchart for receiving serial data. the procedure is as follows (the steps correspond to the numbers in the flowchart). 1. sci initialization: set the rxd pin using the pfc. 2. receive error handling and break detection: if a receive error occurs, read the orer, per, and fer bits of ssr to identify the error. after executing the necessary error handling, clear orer, per, and fer all to 0. receiving cannot resume if orer, per or fer remain set to 1. when a framing error occurs, the rxd pin can be read to detect the break state. 3. sci status check and receive-data read: read the serial status register (ssr), check that rdrf is set to 1, then read receive data from the receive data register (rdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 4. continue receiving serial data: read rdr and the rdrf bit and clear rdrf to 0 before the stop bit of the current frame is received. if the dmac is started by a receive-data-full interrupt (rxi) to read rdr, the rdrf bit is cleared automatically so this step is unnecessary.
473 start of reception initialization read orer, per, and fer bits in ssr read receive data in rdr and clear rdrf bit in ssr to 0 end of reception 1 4 no no yes yes read rdrf bit in ssr rdrf = 1? per, fer, orer = 1? clear re bit in scr to 0 yes no 3 error handling 2 all data received? figure 14.7 sample flowchart for receiving serial data (1)
474 error handling orer = 1? overrun error handling fer = 1? yes break? no framing error handling per = 1? yes parity error handling clear orer, per, and fer to 0 in ssr end clear re bit in scr to 0 no no no yes yes figure 14.8 sample flowchart for receiving serial data (2)
475 in receiving, the sci operates as follows: 1. the sci monitors the communication line. when it detects a start bit (0), the sci synchronizes internally and starts receiving. 2. receive data is shifted into rsr in order from the lsb to the msb. 3. the parity bit and stop bit are received. after receiving these bits, the sci makes the following checks: a. parity check. the number of 1s in the receive data must match the even or odd parity setting of the o/e bit in smr. b. stop bit check. the stop bit value must be 1. if there are two stop bits, only the first stop bit is checked. c. status check. rdrf must be 0 so that receive data can be loaded from rsr into rdr. if the data passes these checks, the sci sets rdrf to 1 and stores the receive data in rdr. if one of the checks fails (receive error), the sci operates as indicated in table 14.11. note: when a receive error occurs, further receiving is disabled. while receiving, the rdrf bit is not set to 1, so be sure to clear the error flags. 4. after setting rdrf to 1, if the receive-data-full interrupt enable bit (rie) is set to 1 in scr, the sci requests a receive-data-full interrupt (rxi). if one of the error flags (orer, per, or fer) is set to 1 and the receive-data-full interrupt enable bit (rie) in scr is also set to 1, the sci requests a receive-error interrupt (eri). table 14.11 receive error conditions and sci operation receive error abbreviation condition data transfer overrun error orer receiving of next data ends while rdrf is still set to 1 in ssr receive data not loaded from rsr into rdr framing error fer stop bit is 0 receive data loaded from rsr into rdr parity error per parity of receive data differs from even/odd parity setting in smr receive data loaded from rsr into rdr figure 14.9 shows an example of sci receive operation in asynchronous mode.
476 rdrf fer framing error generates eri interrupt request. 1 frame rxi interrupt handler reads data in rdr and clears rdrf to 0. 01 1 1 0/1 0 1 parity bit parity bit serial data start bit data stop bit start bit data stop bit idling (marking) d0 d1 d7 d0 d1 d7 0/1 rxi interrupt request figure 14.9 sci receive operation (example: 8-bit data with parity and one stop bit) 14.3.3 multiprocessor communication the multiprocessor communication function enables several processors to share a single serial communication line for sending and receiving data. the processors communicate in the asynchronous mode using a format with an additional multiprocessor bit (multiprocessor format). in multiprocessor communication, each receiving processor is addressed by a unique id. a serial communication cycle consists of an id-sending cycle that identifies the receiving processor, and a data-sending cycle. the multiprocessor bit distinguishes id-sending cycles from data-sending cycles. the transmitting processor starts by sending the id of the receiving processor with which it wants to communicate as data with the multiprocessor bit set to 1. next the transmitting processor sends transmit data with the multiprocessor bit cleared to 0. receiving processors skip incoming data until they receive data with the multiprocessor bit set to 1. when they receive data with the multiprocessor bit set to 1, receiving processors compare the data with their ids. the receiving processor with a matching id continues to receive further incoming data. processors with ids not matching the received data skip further incoming data until they again receive data with the multiprocessor bit set to 1. multiple processors can send and receive data in this way. figure 14.10 shows an example of communication among processors using the multiprocessor format.
477 communication formats: four formats are available. parity-bit settings are ignored when the multiprocessor format is selected. for details see table 14.8. clock: see the description in the asynchronous mode section. receiving processor a (id = 01) (id = 02) (id = 03) (id = 04) receiving processor b receiving processor c serial communication line h'01 h'aa (mpb = 0) (mpb = 1) id-transmit cycle: receiving processor address serial data mpb: multiprocessor bit transmitting processor receiving processor d data-transmit cycle: data sent to receiving processor specified by id figure 14.10 communication among processors using multiprocessor format (example: sending data h'aa to receiving processor a) data transmit/receive operation transmitting multiprocessor serial data: figure 14.11 shows a sample flowchart for transmitting multiprocessor serial data. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the txd pin using the pfc. 2. sci status check and transmit data write: read the serial status register (ssr), check that the tdre bit is 1, then write transmit data in the transmit data register (tdr). also set mpbt (multiprocessor bit transfer) to 0 or 1 in ssr. finally, clear tdre to 0. 3. continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in tdr, then clear tdre to 0. when the dmac is started by a transmit-data-empty interrupt request (txi) to write data in tdr, the tdre bit is checked and cleared automatically. 4. output a break at the end of serial transmission: set the data register (dr) of the port to 0, then clear te to 0 in scr and set the txd pin function as output port with the pfc.
478 tdre = 1? write transmit data in tdr and set mpbt in ssr all data transmitted? yes tend = 1? read tend bit in ssr output break signal? yes clear port dr to 0 clear te bit in scr to 0; select thetxd pin function as an output port with the pfc end of transmission yes read tdre bit in ssr clear tdre bit to 0 initialization no no yes no no 1 2 3 4 start of transmission figure 14.11 sample flowchart for transmitting multiprocessor serial data
479 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in ssr. when tdre is cleared to 0 the sci recognizes that the transmit data register (tdr) contains new data, and loads this data from tdr into the transmit shift register (tsr). 2. after loading the data from tdr into tsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) in scr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd pin: a. start bit: one 0-bit is output. b. transmit data: seven or eight bits are output, lsb first. c. multiprocessor bit: one multiprocessor bit (mpbt value) is output. d. stop bit: one or two 1-bits (stop bits) are output. e. marking: output of 1-bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads data from tdr into tsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in ssr to 1, outputs the stop bit, then continues output of 1-bits in the marking state. if the transmit-end interrupt enable bit (teie) in scr is set to 1, a transmit-end interrupt (tei) is requested at this time. figure 14.12 shows an example of sci receive operation in the multiprocessor format. tdre tend txi interrupt handler writes data in tdr and clears tdre to 0 txi interrupt request tei interrupt request 1 frame 01 1 1 0/1 0 1 multiprocessor bit multiprocessor bit serial data start bit data stop bit start bit data stop bit idling (marking) d0 d1 d7 d0 d1 d7 0/1 txi interrupt request figure 14.12 sci multiprocessor transmit operation (example: 8-bit data with multiprocessor bit and one stop bit)
480 receiving multiprocessor serial data: figures 14.13 and 14.14 show sample flowcharts for receiving multiprocessor serial data. the procedure for receiving multiprocessor serial data is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the rxd pin using the pfc. 2. id receive cycle: set the mpie bit in the serial control register (scr) to 1. 3. sci status check and compare to id reception: read the serial status register (ssr), check that rdrf is set to 1, then read data from the receive data register (rdr) and compare with the processor? own id. if the id does not match the receive data, set mpie to 1 again and clear rdrf to 0. if the id matches the receive data, clear rdrf to 0. 4. receive error handling and break detection: if a receive error occurs, read the orer and fer bits in ssr to identify the error. after executing the necessary error handling, clear both orer and fer to 0. receiving cannot resume if orer or fer remain set to 1. when a framing error occurs, the rxd pin can be read to detect the break state. 5. sci status check and data receiving: read ssr, check that rdrf is set to 1, then read data from the receive data register (rdr).
481 rdrf = 1? fer = 1? or orer =1? rdrf = 1? all data received? no end of reception yes set mpie bit in scr to 1 read rdrf bit in ssr initialization clear re bit in scr to 0 yes no 1 2 3 read orer and fer bits in ssr fer = 1? or orer =1? read rdrf bit in ssr read receive data from rdr is id the station ? s id? no read orer and fer bits in ssr read receive data from rdr no error handling no yes 5 4 yes yes no yes start of reception figure 14.13 sample flowchart for receiving multiprocessor serial data (1)
482 orer = 1? break? yes framing error handling yes error handling overrun error handling yes fer = 1? clear orer and fer bits in ssr to 0 end no no no clear re bit in scr to 0 figure 14.14 sample flowchart for receiving multiprocessor serial data (2)
483 figures 14.15 and 14.16 show examples of sci receive operation using a multiprocessor format. rdrf mpie rdr value id1 rxi interrupt request (multiprocessor interrupt), mpie = 0 rxi interrupt handler reads data in rdr and clears rdrf to 0 not station s id, so mpie is set to 1 again no rxi interrupt, rdr maintains state 01 1 1 10 1 serial data start bit stop bit start bit stop bit idling (marking) d0 d1 d7 d0 d1 d7 0 mpb mpb mpb data (id1) data (data 1) figure 14.15 sci receive operation (id does not match) (example: 8-bit data with multiprocessor bit and one stop bit)
484 rdrf mpie rdr value id2 01 1 1 10 1 mpb mpb serial data start bit data (id2) data (data 2) stop bit start bit stop bit idling (marking) d0 d1 d7 d0 d1 d7 0 rxi interrupt request (multiprocessor interrupt), mpie = 0 rxi interrupt handler reads data in rdr and clears rdrf to 0 station ? s id, so receiving continues, with data received by the rxi interrupt processing routine mpie bit is again set to 1 mpb data 2 id1 figure 14.16 example of sci receive operation (id matches) (example: 8-bit data with multiprocessor bit and one stop bit) 14.3.4 synchronous operation in synchronous mode, the sci transmits and receives data in synchronization with clock pulses. this mode is suitable for high-speed serial communication. the sci transmitter and receiver are independent, so full duplex communication is possible while sharing the same clock. the transmitter and receiver are also double buffered, so continuous transmitting or receiving is possible by reading or writing data while transmitting or receiving is in progress. figure 14.17 shows the general format in synchronous serial communication.
485 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 lsb msb serial clock serial data * * transfer direction one unit (character or frame) of communication data note: * high except in continuous transmitting or receiving. figure 14.17 data format in synchronous communication in synchronous serial communication, each data bit is output on the communication line from one falling edge of the serial clock to the next. data is guaranteed valid at the rising edge of the serial clock. in each character, the serial data bits are transmitted in order from the lsb (first) to the msb (last). after output of the msb, the communication line remains in the state of the msb. in synchronous mode, the sci transmits or receives data by synchronizing with the rise of the serial clock. communication format: the data length is fixed at eight bits. no parity bit or multiprocessor bit can be added. clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in the serial mode register (smr) and bits cke1 and cke0 in the serial control register (scr). see table 14.9. when the sci operates on an internal clock, it outputs the clock signal at the sck pin. eight clock pulses are output per transmitted or received character. when the sci is not transmitting or receiving, the clock signal remains in the high state. an overrun error occurs only during the receive operation, and the serial clock is output until the re bit is cleared to 0. to perform a receive operation in one-character units, select an external clock for the clock source.
486 transmitting and receiving data sci initialization (synchronous mode): before transmitting or receiving, software must clear the te and re bits to 0 in the serial control register (scr), then initialize the sci as follows. when changing the mode or communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 sets tdre to 1 and initializes the transmit shift register (tsr). clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags and receive data register (rdr), which retain their previous contents. figure 14.18 is a sample flowchart for initializing the sci. 1. select the clock source in the serial control register (scr). leave rie, tie, teie, mpie, te, and re cleared to 0. 2. select the communication format in the serial mode register (smr) and serial direction control register (sdcr). 3. write the value corresponding to the bit rate in the bit rate register (brr) (unless an external clock is used). 4. wait for at least the interval required to transmit or receive one bit, then set te or re in the serial control register (scr) to 1.* also set rie, tie, teie, and mpie. the txd, rxd pins becomes usable in response to the pfc corresponding bits and the te, re bit settings. note: * in simultaneous transmit/receive operation, the te bit and re bit must be cleared to 0 or set to 1 simultaneously.
487 start of initialization clear te and re bits to 0 in scr 1-bit interval elapsed? set te and re to 1 in scr; set rie, tie, teie, and mpie bits yes no 1 set cke1 and cke0 bits in scr (rie, tie, teie, mpie,te, and re are 0) end of initialization wait select transmit/receive format in smr and sdcr set value in brr 2 3 4 figure 14.18 sample flowchart for sci initialization transmitting serial data (synchronous mode): figure 14.19 shows a sample flowchart for transmitting serial data. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the txd pin function with the pfc. 2. sci status check and transmit data write: read ssr, check that the tdre flag is 1, then write transmit data in tdr and clear the tdre flag to 0. 3. to continue transmitting serial data: after checking that the tdre flag is 1, indicating that data can be written, write data in tdr, then clear the tdre flag to 0. when the dmac is activated by a transmit-data-empty interrupt request (txi) to write data in tdr, the tdre flag is checked and cleared automatically.
488 start of transmission read tdre flag in ssr tdre = 1? write transmit data in tdr and clear tdre flag to 0 in ssr all data transmitted? read tend flag in ssr yes no no no yes tend = 1? yes end clear te bit to 0 in scr initialization 2 3 1 figure 14.19 sample flowchart for serial transmitting
489 figure 14.20 shows an example of sci transmit operation. bit 0 bit 1 bit 7 bit 0 bit 1 bit 6 serial clock serial data transfer direction bit 7 txi interrupt handler writes data in tdr and clears tdre to 0 1 frame txi interrupt request tdre tend lsb msb tei interrupt request txi interrupt request figure 14.20 example of sci transmit operation sci serial transmission operates as follows. 1. the sci monitors the tdre bit in ssr. when tdre is cleared to 0 the sci recognizes that the transmit data register (tdr) contains new data and loads this data from tdr into the transmit shift register (tsr). 2. after loading the data from tdr into tsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) in scr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. if clock output mode is selected, the sci outputs eight serial clock pulses. if an external clock source is selected, the sci outputs data in synchronization with the input clock. data is output from the txd pin in order from the lsb (bit 0) to the msb (bit 7). 3. the sci checks the tdre bit when it outputs the msb (bit 7). if tdre is 0, the sci loads data from tdr into tsr, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in ssr to 1, transmits the msb, then holds the transmit data pin (txd) in the msb state. if the transmit-end interrupt enable bit (teie) in scr is set to 1, a transmit- end interrupt (tei) is requested at this time. 4. after the end of serial transmission, the sck pin is held in the high state.
490 receiving serial data (synchronous mode): figures 14.21 and 14.22 show sample flowcharts for receiving serial data. when switching from asynchronous mode to synchronous mode, make sure that orer, per, and fer are cleared to 0. if per or fer is set to 1, the rdrf bit will not be set and both transmitting and receiving will be disabled. the procedure for receiving serial data is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the rxd pin using the pfc. 2. receive error handling: if a receive error occurs, read the orer bit in ssr to identify the error. after executing the necessary error handling, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. 3. sci status check and receive data read: read the serial status register (ssr), check that rdrf is set to 1, then read receive data from the receive data register (rdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 4. continue receiving serial data: read rdr, and clear rdrf to 0 before the msb (bit 7) of the current frame is received. if the dmac is started by a receive-data-full interrupt (rxi) to read rdr, the rdrf bit is cleared automatically so this step is unnecessary.
491 start of reception initialization read orer bit in ssr all data received? end of reception 1 no yes orer = 1? read receive data from rdr and clear rdrf bit in ssr to 0 rdrf = 1? yes yes no clear re bit in scr to 0 no read rdrf bit in ssr error handling 3 4 2 figure 14.21 sample flowchart for serial receiving (1)
492 error handling end clear orer bit in ssr to 0 overrun error handling figure 14.22 sample flowchart for serial receiving (2) figure 14.23 shows an example of the sci receive operation. bit 7 bit 0 bit 7 bit 0 bit 1 bit 6 serial clock serial data transfer direction bit 7 read data with rxi interrupt processing routine and clear rdrf bit to 0 1 frame rxi interrupt request rxi interrupt request eri interrupt request generated by overrun error rdrf orer figure 14.23 example of sci receive operation
493 in receiving, the sci operates as follows: 1. the sci synchronizes with serial clock input or output and initializes internally. 2. receive data is shifted into rsr in order from the lsb to the msb. after receiving the data, the sci checks that rdrf is 0 so that receive data can be loaded from rsr into rdr. if this check passes, the sci sets rdrf to 1 and stores the receive data in rdr. if the check does not pass (receive error), the sci operates as indicated in table 14.11 and no further transmission or reception is possible. if the error flag is set to 1, the rdrf bit is not set to 1 during reception, even if the rdrf bit is 0 cleared. when restarting reception, be sure to clear the error flag. 3. after setting rdrf to 1, if the receive-data-full interrupt enable bit (rie) is set to 1 in scr, the sci requests a receive-data-full interrupt (rxi). if the orer bit is set to 1 and the receive- data-full interrupt enable bit (rie) in scr is also set to 1, the sci requests a receive-error interrupt (eri). transmitting and receiving serial data simultaneously (synchronous mode): figure 14.24 shows a sample flowchart for transmitting and receiving serial data simultaneously. the procedure is as follows (the steps correspond to the numbers in the flowchart): 1. sci initialization: set the txd and rxd pins using the pfc. 2. sci status check and transmit data write: read the serial status register (ssr), check that the tdre bit is 1, then write transmit data in the transmit data register (tdr) and clear tdre to 0. the txi interrupt can also be used to determine if the tdre bit has changed from 0 to 1. 3. receive error handling: if a receive error occurs, read the orer bit in ssr to identify the error. after executing the necessary error handling, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. 4. sci status check and receive data read: read the serial status register (ssr), check that rdrf is set to 1, then read receive data from the receive data register (rdr) and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 5. continue transmitting and receiving serial data: read the rdrf bit and rdr, and clear rdrf to 0 before the msb (bit 7) of the current frame is received. also read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in tdr, then clear tdre to 0 before the msb (bit 7) of the current frame is transmitted. when the dmac is started by a transmit- data-empty interrupt request (txi) to write data in tdr, the tdre bit is checked and cleared automatically. when the dmac is started by a receive-data-full interrupt (rxi) to read rdr, the rdrf bit is cleared automatically. note: in switching from transmitting or receiving to simultaneous transmitting and receiving, clear both te and re to 0, then set both te and re to 1 simultaneously.
494 start of transmission/reception initialization read tdre bit in ssr all data transmitted/ received? end of transmission/reception 1 2 no yes tdre = 1? write transmit data in tdr and clear tdre bit in ssr to 0 rdrf = 1? yes no clear te and re bits in scr to 0 yes no read orer bit in ssr error handling 3 orer = 1? yes read receive data in rdr, and clear rdrf bit in ssr to 0 read rdrf bit in ssr 4 5 no figure 14.24 sample flowchart for serial transmission and reception
495 14.4 sci interrupt sources and the dmac the sci has four interrupt sources: transmit-end (tei), receive-error (eri), receive-data-full (rxi), and transmit-data-empty (txi). table 14.12 lists the interrupt sources and indicates their priority. these interrupts can be enabled and disabled by the tie, rie, and teie bits in the serial control register (scr). each interrupt request is sent separately to the interrupt controller. txi is requested when the tdre bit in ssr is set to 1. txi can start the direct memory access controller (dmac) to transfer data. tdre is automatically cleared to 0 when the dmac writes data in the transmit data register (tdr). rxi is requested when the rdrf bit in ssr is set to 1. rxi can start the dmac to transfer data. rdrf is automatically cleared to 0 when the dmac reads the receive data register (rdr). eri is requested when the orer, per, or fer bit in ssr is set to 1. eri cannot start the dmac. tei is requested when the tend bit in ssr is set to 1. tei cannot start the dmac. where the txi interrupt indicates that transmit data writing is enabled, the tei interrupt indicates that the transmit operation is complete. table 14.12 sci interrupt sources interrupt source description dmac activation priority eri receive error (orer, per, or fer) no high rxi receive data full (rdrf) yes txi transmit data empty (tdre) yes tei transmit end (tend) no low
496 14.5 usage notes sections 14.5.1 through 14.5.9 provide information concerning use of the sci. 14.5.1 tdr write and tdre flag the tdre bit in the serial status register (ssr) is a status flag indicating loading of transmit data from tdr into tsr. the sci sets tdre to 1 when it transfers data from tdr to tsr. data can be written to tdr regardless of the tdre bit status. if new data is written in tdr when tdre is 0, however, the old data stored in tdr will be lost because the data has not yet been transferred to tsr. before writing transmit data to tdr, be sure to check that tdre is set to 1. 14.5.2 simultaneous multiple receive errors table 14.13 indicates the state of the ssr status flags when multiple receive errors occur simultaneously. when an overrun error occurs, the rsr contents cannot be transferred to rdr, so receive data is lost. table 14.13 ssr status flags and transfer of receive data ssr status flags receive data transfer receive error status rdrf orer fer per rsr rdr overrun error 1 1 0 0 x framing error 0 0 1 0 o parity error 0 0 0 1 o overrun error + framing error 1 1 1 0 x overrun error + parity error 1 1 0 1 x framing error + parity error 0 0 1 1 o overrun error + framing error + parity error 1111x note: o: receive data is transferred from rsr to rdr. x: receive data is not transferred from rsr to rdr.
497 14.5.3 break detection and processing (asynchronous mode only) break signals can be detected by reading the rxd pin directly when a framing error (fer) is detected. in the break state, the input from the rxd pin consists of all 0s, so fer is set and the parity error flag (per) may also be set. in the break state, the sci receiver continues to operate, so if the fer bit is cleared to 0, it will be set to 1 again. 14.5.4 sending a break signal (asynchronous mode only) the txd pin becomes a general i/o pin with the i/o direction and level determined by the i/o port data register (dr) and pin function controller (pfc) control register (cr). these conditions allow break signals to be sent. the dr value is substituted for the marking status until the pfc is set. consequently, the output port is set to initially output a 1. to send a break in serial transmission, first clear the dr to 0, then establish the txd pin as an output port using the pfc. when te is cleared to 0, the transmission section is initialized regardless of the present transmission status. 14.5.5 receive error flags and transmitter operation (synchronous mode only) when a receive error flag (orer, per, or fer) is set to 1, the sci will not start transmitting even if tdre is set to 1. be sure to clear the receive error flags to 0 before starting to transmit. note that clearing re to 0 does not clear the receive error flags. 14.5.6 receive data sampling timing and receive margin in asynchronous mode in asynchronous mode, the sci operates on a base clock with a frequency of 16 times the transfer rate. in receiving, the sci synchronizes internally with the falling edge of the start bit, which it samples on the base clock. receive data is latched on the rising edge of the eighth base clock pulse (figure 14.25).
498 01234567 12345 12345 67 8 9 10 11 12 13 14 15 9 10 11 12 13 14 15 080 base clock receive data (rxd) synchronization sampling timing data sampling timing 8 clocks 16 clocks start bit e 7.5 clocks +7.5 clocks d0 d1 figure 14.25 receive data sampling timing in asynchronous mode the receive margin in asynchronous mode can therefore be expressed as: m = 0.5 1 2n d 0.5 n (l 0.5) f (1 + f) from the equation above, if f = 0 and d = 0.5 the receive margin is 46.875%: d = 0.5, f = 0 m = (0.5 1/(2 this is a theoretical value. a reasonable margin to allow in system designs is 20 to 30%.
499 14.5.7 constraints on dmac use ? when using an external clock source for the serial clock, update tdr with the dmac, and then after the elapse of five peripheral clocks (p ) or more, input a transmit clock. if a transmit clock is input in the first four p clocks after tdr is written, an error may occur (figure 14.26). ? before reading the receive data register (rdr) with the dmac, select the receive-data-full (rxi) interrupt of the sci as a start-up source. d0 d1 d2 d3 d4 d5 d6 d7 sck tdre t note: during external clock operation, an error may occur if t is 4 p figure 14.26 example of synchronous transmission with dmac 14.5.8 cautions on synchronous external clock mode ? set te = re = 1 only when external clock sck is 1. ? do not set te = re = 1 until at least four p clocks after external clock sck has changed from 0 to 1. ? when receiving, rdrf is 1 when re is cleared to zero 2.5 to 3.5 p clocks after the rising edge of the rxd d7 bit sck input, but copying to rdr is not possible. 14.5.9 caution on synchronous internal clock mode when receiving, rdrf is 1 when re is cleared to zero 1.5 p clocks after the rising edge of the rxd d7 bit sck output, but copying to rdr is not possible.
500
501 section 15 hitachi controller area network (hcan) 15.1 overview the hcan is a module for controlling a controller area network (can) for realtime communication in automotive and industrial equipment systems, etc. the sh7052f/sh7053f/ sh7054f has a 1-channel on-chip hcan module. reference: bosch can specification version 2.0 1991, robert bosch gmbh 15.1.1 features the hcan has the following features: ? can version: bosch 2.0b active compatible ? communication systems: nrz (non-return to zero) system (with bit-stuffing function) broadcast communication system ? transmission path: bidirectional 2-wire serial communication ? communication speed: max. 1 mbps (at 40 mhz operation) ? data length: 0 to 8 bytes ? number of channels: 1 ? data buffers: 16 (one receive-only buffer and 15 buffers settable for transmission/reception) ? data transmission: choice of two methods: ? mailbox (buffer) number order (low-to-high) ? message priority (identifier) high-to-low order ? data reception: two methods: ? message identifier match (transmit/receive-setting buffers) ? reception with message identifier masked (receive-only) ? cpu interrupts: four independent interrupt vectors: ? error interrupt ? reset processing interrupt ? message reception interrupt ? message transmission interrupt ? hcan operating modes: support for various modes: ? hardware reset ? software reset ? normal status (error-active, error-passive)
502 ? bus off status ? hcan configuration mode ? hcan sleep mode ? hcan halt mode ? other features: dmac can be activated by message reception mailbox (hcan mailbox 0 only) 15.1.2 block diagram figure 15.1 shows a block diagram of the hcan. peripheral address bus peripheral data bus htxd mbi message buffer hrxd mpi microprocessor interface (cdlc) can data link controller bosch can 2.0b active cpu interface control register status register hcan tx buffer rx buffer message control message data mc0 to mc15, md0 to md15 lafm mailboxes figure 15.1 hcan block diagram message buffer interface (mbi): the mbi, consisting of mailboxes and a local acceptance filter mask (lafm), stores can transmit/receive messages (identifiers, data, etc.). transmit messages are written by the cpu. for receive messages, the data received by the cdlc is stored automatically. microprocessor interface (mpi): the mpi, consisting of a bus interface, control register, status register, etc., controls hcan internal data, statuses, and so forth. can data link controller (cdlc): the cdlc performs transmission and reception of messages conforming to the bosch can ver. 2.0b active standard (data frames, remote frames, error frames, overload frames, inter-frame spacing), as well as crc checking, bus arbitration, and other functions.
503 15.1.3 pin configuration table 15.1 shows the hcan? pins. when using the functions of these external pins, the pin function controller (pfc) must also be set in line with the hcan settings. when using hcan pins, settings must be made in the hcan configuration mode (during initialization: mcr0 = 1 and gsr3 = 1). table 15.1 hcan pins name abbreviation input/output function hcan transmit data pin htxd output can bus transmission pin hcan receive data pin hrxd input can bus reception pin a bus driver is necessary between the pins and the can bus. a philips pca82c250 compatible model is recommended.
504 15.1.4 register configuration table 15.2 lists the hcan? registers. table 15.2 hcan registers name abbreviation r/w initial value address access size master control register mcr r/w h'01 h'ffff e400 8 bits 16 bits general status register gsr r h'0c h'ffff e401 8 bits bit configuration register bcr r/w h'0000 h'ffff e402 8/16 bits mailbox configuration register mbcr r/w h'0100 h'ffff e404 8/16 bits transmit wait register txpr r/w h'0000 h'ffff e406 8/16 bits transmit wait cancel register txcr r/w h'0000 h'ffff e408 8/16 bits transmit acknowledge register txack r/w h'0000 h'ffff e40a 8/16 bits abort acknowledge register aback r/w h'0000 h'ffff e40c 8/16 bits receive complete register rxpr r/w h'0000 h'ffff e40e 8/16 bits remote request register rfpr r/w h'0000 h'ffff e410 8/16 bits interrupt register irr r/w h'0100 h'ffff e412 8/16 bits mailbox interrupt mask register mbimr r/w h'ffff h'ffff e414 8/16 bits interrupt mask register imr r/w h'feff h'ffff e416 8/16 bits receive error counter rec r h'00 h'ffff e418 8 bits 16 bits transmit error counter tec r h'00 h'ffff e419 8 bits unread message status register umsr r/w h'0000 h'ffff e41a 8/16 bits local acceptance filter mask l lafml r/w h'0000 h'ffff e41c 8/16 bits local acceptance filter mask h lafmh r/w h'0000 h'ffff e41e 8/16 bits
505 table 15.2 hcan registers (cont) name abbreviation r/w initial value address access size message control 0 [1:8] mc0 [1:8] r/w undefined h'ffff e420 8/16 bits message control 1 [1:8] mc1 [1:8] r/w undefined h'ffff e428 8/16 bits message control 2 [1:8] mc2 [1:8] r/w undefined h'ffff e430 8/16 bits message control 3 [1:8] mc3 [1:8] r/w undefined h'ffff e438 8/16 bits message control 4 [1:8] mc4 [1:8] r/w undefined h'ffff e440 8/16 bits message control 5 [1:8] mc5 [1:8] r/w undefined h'ffff e448 8/16 bits message control 6 [1:8] mc6 [1:8] r/w undefined h'ffff e450 8/16 bits message control 7 [1:8] mc7 [1:8] r/w undefined h'ffff e458 8/16 bits message control 8 [1:8] mc8 [1:8] r/w undefined h'ffff e460 8/16 bits message control 9 [1:8] mc9 [1:8] r/w undefined h'ffff e468 8/16 bits message control 10 [1:8] mc10 [1:8] r/w undefined h'ffff e470 8/16 bits message control 11 [1:8] mc11 [1:8] r/w undefined h'ffff e478 8/16 bits message control 12 [1:8] mc12 [1:8] r/w undefined h'ffff e480 8/16 bits message control 13 [1:8] mc13 [1:8] r/w undefined h'ffff e488 8/16 bits message control 14 [1:8] mc14 [1:8] r/w undefined h'ffff e490 8/16 bits message control 15 [1:8] mc15 [1:8] r/w undefined h'ffff e498 8/16 bits message data 0 [1:8] md0 [1:8] r/w undefined h'ffff e4b0 8/16 bits message data 1 [1:8] md1 [1:8] r/w undefined h'ffff e4b8 8/16 bits message data 2 [1:8] md2 [1:8] r/w undefined h'ffff e4c0 8/16 bits message data 3 [1:8] md3 [1:8] r/w undefined h'ffff e4c8 8/16 bits message data 4 [1:8] md4 [1:8] r/w undefined h'ffff e4d0 8/16 bits message data 5 [1:8] md5 [1:8] r/w undefined h'ffff e4d8 8/16 bits message data 6 [1:8] md6 [1:8] r/w undefined h'ffff e4e0 8/16 bits message data 7 [1:8] md7 [1:8] r/w undefined h'ffff e4e8 8/16 bits message data 8 [1:8] md8 [1:8] r/w undefined h'ffff e4f0 8/16 bits message data 9 [1:8] md9 [1:8] r/w undefined h'ffff e4f8 8/16 bits message data 10 [1:8] md10 [1:8] r/w undefined h'ffff e500 8/16 bits message data 11 [1:8] md11 [1:8] r/w undefined h'ffff e508 8/16 bits message data 12 [1:8] md12 [1:8] r/w undefined h'ffff e510 8/16 bits message data 13 [1:8] md13 [1:8] r/w undefined h'ffff e518 8/16 bits message data 14 [1:8] md14 [1:8] r/w undefined h'ffff e520 8/16 bits message data 15 [1:8] md15 [1:8] r/w undefined h'ffff e528 8/16 bits
506 15.2 register descriptions 15.2.1 master control register (mcr) the master control register (mcr) is an 8-bit readable/writable register that controls the can interface. bit: 7 6 5 4 3 2 1 0 mcr7 mcr5 mcr2 mcr1 mcr0 initial value: 0 0 0 0 0 0 0 1 r/w: r/w r/w r/w r/w r/w ? bit 7?can sleep mode release (mcr7): enables or disables hcan sleep mode release by bus operation. bit 7: mcr7 description 0 hcan sleep mode release by can bus operation disabled (initial value) 1 hcan sleep mode release by can bus operation enabled ? bit 6?eserved: this bit always reads 0. the write value should always be 0. ? bit 5?can sleep mode (mcr5): enables or disables hcan sleep mode transition. bit 5: mcr5 description 0 hcan sleep mode released (initial value) 1 transition to hcan sleep mode enabled ? bits 4 and 3?eserved: these bits always read 0. the write value should always be 0. ? bit 2?essage transmission method (mcr2): selects the transmission method for transmit messages. bit 2: mcr2 description 0 transmission order determined by message identifier priority (initial value) 1 transmission order determined by mailbox (buffer) number priority (txpr1 > txpr15)
507 ? bit 1?alt request (mcr1): controls halting of the hcan module. bit 1: mcr1 description 0 normal operating mode (initial value) 1 halt mode transition request ? bit 0?eset request (mcr0): controls resetting of the hcan module. bit 0: mcr0 description 0 normal operating mode (mcr0 = 0 and gsr3 = 0) [setting condition] when 0 is written after an hcan reset 1 reset mode transition request (initial value) in order for gsr3 to change from 1 to 0 after 0 is written to mcr0, time is required before the hcan is internally reset. there is consequently a delay before gsr3 is cleared to 0 after mcr0 is cleared to 0. 15.2.2 general status register (gsr) the general status register (gsr) is an 8-bit readable/writable register that indicates the status of the can bus. bit: 7 6 5 4 3 2 1 0 gsr3 gsr2 gsr1 gsr0 initial value: 0 0 0 0 1 1 0 0 r/w: r r r r r r r r ? bits 7 to 4?eserved: these bits always read 0. the write value should always be 0. ? bit 3?eset status bit (gsr3): indicates whether the hcan module is in the normal operating state or the reset state. this bit cannot be modified. bit 3: mcr3 description 0 normal operating state [setting condition] after an hcan internal reset 1 configuration mode (initial value) [reset condition] mcr0-initiated reset state or sleep mode
508 ? bit 2?essage transmission status flag (gsr2): flag that indicates whether the module is currently in the message transmission period. the ?essage transmission period?is the period from the start of message transmission (sof) until the end of a 3-bit intermission interval after eof (end of frame). this bit cannot be modified. bit 2: gsr2 description 0 transmission in progress 1 [reset condition] idle period (initial value) ? bit 1?ransmit/receive warning flag (gsr1): flag that indicates an error warning. this bit cannot be modified. it 1: gsr1 description 0 [reset condition] when tec < 96 and rec < 96 or tec ? bit 0?us off flag (gsr0): flag that indicates the bus off state. this bit cannot be modified. bit 0: gsr0 description 0 [reset condition] recovery from bus off state (initial value) 1 when tec 15.2.3 bit configuration register (bcr) the bit configuration register (bcr) is a 16-bit readable/writable register that is used to set can bit timing parameters and the baud rate prescaler. bit: 15 14 13 12 11 10 9 8 bcr7 bcr6 bcr5 bcr4 bcr3 bcr2 bcr1 bcr0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 bcr15 bcr14 bcr13 bcr12 bcr11 bcr10 bcr9 bcr8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
509 ? bits 15 and 14?e-synchronization jump width (sjw): these bits set the maximum bit synchronization range. bit 15: bcr7 bit 14: bcr6 description 0 0 maximum bit synchronization width = 1 time quantum 1 maximum bit synchronization width = 2 time quanta 1 0 maximum bit synchronization width = 3 time quanta 1 maximum bit synchronization width = 4 time quanta ? bits 13 to 8?aud rate prescale (brp): these bits are used to set the can bus baud rate. bit 13: bcr5 bit 12: bcr4 bit 11: bcr3 bit 10: bcr2 bit 9: bcr1 bit 8: bcr0 description 0000002 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sync_seg prseg phseg1 phseg2 1-bit time 1-bit time (8 e 25 time quanta) quantum 1 tseg1 (time segment 1) * 2 e 16 tseg2 (time segment 2) * 2 e 8 sync_seg: segment for establishing synchronization of nodes on the can bus. (normal bit edge transitions occur in this segment.) prseg: segment for compensating for physical delay between networks. phseg1: buffer segment for correcting phase drift (positive). (this segment is extended when synchronization (re-synchronization) is established.) phseg2: buffer segment for correcting phase drift (negative). (this segment is shortened when synchronization (re-synchronization) is established.) note: * the time quanta value for tseg1 and tseg2 is the tseg value + 1. figure 15.2 detailed description of one bit
510 hcan bit rate calculation: f clk 2 (brp + 1) (3 + tseg1 + tseg2) bit rate [b/s] = note: f clk = p (peripheral clock ( /2)) the bcr values are used for brp, tseg1, and tseg2. bcr setting constraints tseg1 > tseg2 sjw (sjw = 1 to 4) 3 + tseg1 + tseg2 = 8 to 25 time quanta tseg2 > b'001 (brp = b'000000) tseg2 > b'000 (brp > b'000000) these constraints allow the setting range shown in table 15.3 for tseg1 and tseg2 in bcr. table 15.3 setting range for tseg1 and tseg2 in bcr tseg2 (bcr [14:12]) 001 010 011 100 101 110 111 tseg1 0011 no yes no no no no no (bcr [11:8]) 0100 yes * yes yes no no no no 0101 yes * yes yes yes no no no 0110 yes * yes yes yes yes no no 0111 yes * yes yes yes yes yes no 1000 yes * yes yes yes yes yes yes 1001 yes * yes yes yes yes yes yes 1010 yes * yes yes yes yes yes yes 1011 yes * yes yes yes yes yes yes 1100 yes * yes yes yes yes yes yes 1101 yes * yes yes yes yes yes yes 1110 yes * yes yes yes yes yes yes 1111 yes * yes yes yes yes yes yes notes: the time quanta value for tseg1 and tseg2 is the tseg value + 1. * setting is enabled except when brp[13:8] = b'000000.
511 ? bit 7 bit sample point (bsp): sets the point at which data is sampled. bit 7: bcr15 description 0 bit sampling at one point (end of time segment 1) (initial value) 1 bit sampling at three points (end of time segment 1, and 1 time quantum before and after) ? bits 6 to 4 time segment 2 (tseg2): these bits are used to set the segment for correcting 1- bit time error. a value from 2 to 8 can be set. bit 6: bcr14 bit 5: bcr13 bit 4: bcr12 description 0 0 0 setting prohibited (initial value) 1 tseg2 (phseg2) = 2 time quanta 1 0 tseg2 (phseg2) = 3 time quanta 1 tseg2 (phseg2) = 4 time quanta 1 0 0 tseg2 (phseg2) = 5 time quanta 1 tseg2 (phseg2) = 6 time quanta 1 0 tseg2 (phseg2) = 7 time quanta 1 tseg2 (phseg2) = 8 time quanta ? bits 3 to 0 time segment 1 (tseg1): these bits are used to set the segment for absorbing output buffer, can bus, and input buffer delay. a value from 1 to 16 can be set. bit 3: bcr11 bit 2: bcr10 bit 1: bcr9 bit 0: bcr8 description 0000 setting prohibited (initial value) 0001 setting prohibited 0010 setting prohibited 0011 tseg1 (prseg + phseg1) = 4 time quanta 0100 tseg1 (prseg + phseg1) = 5 time quanta ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1111 tseg1 (prseg + phseg1) = 16 time quanta
512 15.2.4 mailbox configuration register (mbcr) the mailbox configuration register (mbcr) is a 16-bit readable/writable register that is used to set mailbox (buffer) transmission/reception. bit: 15 14 13 12 11 10 9 8 mbcr7 mbcr6 mbcr5 mbcr4 mbcr3 mbcr2 mbcr1 ? initial value: 0 0 0 0 0 0 0 1 r/w: r/w r/w r/w r/w r/w r/w r/w r bit: 7 6 5 4 3 2 1 0 mbcr15 mbcr14 mbcr13 mbcr12 mbcr11 mbcr10 mbcr9 mbcr8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 9 and 7 to 0 mailbox setting register (mbcr7 to 1, mbcr15 to 8): these bits set the polarity of the corresponding mailboxes (buffers). bit x: mbcrx description 0 corresponding mailbox is set for transmission (initial value) 1 corresponding mailbox is set for reception ? bit 8 reserved: this bit always reads 1. the write value should always be 1. 15.2.5 transmit wait register (txpr) the transmit wait register (txpr) is a 16-bit readable/writable register that is used to set a transmit wait after a transmit message is stored in a mailbox (buffer) (can bus arbitration wait). bit: 15 14 13 12 11 10 9 8 txpr7 txpr6 txpr5 txpr4 txpr3 txpr2 txpr1 ? initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r bit: 7 6 5 4 3 2 1 0 txpr15 txpr14 txpr13 txpr12 txpr11 txpr10 txpr9 txpr8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w
513 ? bits 15 to 9 and 7 to 0 transmit wait register (txpr7 to 1, txpr15 to 8): these bits set a can bus arbitration wait for the corresponding mailboxes (buffers). bit x: txprx description 0 transmit message idle state in corresponding mailbox (initial value) [clearing condition] message transmission completion and cancellation completion 1 transmit message transmit wait in corresponding mailbox (can bus arbitration) ? bit 8 reserved: this bit always reads 0. the write value should always be 0. 15.2.6 transmit wait cancel register (txcr) the transmit wait cancel register (txcr) is a 16-bit readable/writable register that controls cancellation of transmit wait messages in mailboxes (buffers). bit: 15 14 13 12 11 10 9 8 txcr7 txcr6 txcr5 txcr4 txcr3 txcr2 txcr1 ? initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r bit: 7 6 5 4 3 2 1 0 txcr15 txcr14 txcr13 txcr12 txcr11 txcr10 txcr9 txcr8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 9 and 7 to 0 transmit wait cancel register (txcr7 to 1, txcr15 to 8): these bits control cancellation of transmit wait messages in the corresponding hcan mailboxes (buffers). bit x: txcrx description 0 transmit message cancellation idle state in corresponding mailbox (initial value) [clearing condition] completion of txpr clearing (when transmit message is canceled normally) 1 txpr cleared for corresponding mailbox (transmit message cancellation) ? bit 8 reserved: this bit always reads 0. the write value should always be 0.
514 15.2.7 transmit acknowledge register (txack) the transmit acknowledge register (txack) is a 16-bit readable/writable register containing status flags that indicate normal transmission of mailbox (buffer) transmit messages. bit: 15 14 13 12 11 10 9 8 txack7 txack6 txack5 txack4 txack3 txack2 txack1 ? initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r bit: 7 6 5 4 3 2 1 0 txack15 txack14 txack13 txack12 txack11 txack10 txack9 txack8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 9 and 7 to 0 transmit acknowledge register (txack7 to 1, txack15 to 8): these bits indicate that a transmit message in the corresponding hcan mailbox (buffer) has been transmitted normally. bit x: txackx description 0 [clearing condition] writing 1 (initial value) 1 completion of message transmission for corresponding mailbox ? bit 8 reserved: this bit always reads 0. the write value should always be 0.
515 15.2.8 abort acknowledge register (aback) the abort acknowledge register (aback) is a 16-bit readable/writable register containing status flags that indicate normal cancellation (aborting) of a mailbox (buffer) transmit messages. bit: 15 14 13 12 11 10 9 8 aback7 aback6 aback5 aback4 aback3 aback2 aback1 ? initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r bit: 7 6 5 4 3 2 1 0 aback15 aback14 aback13 aback12 aback11 aback10 aback9 aback8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 9 and 7 to 0 abort acknowledge register (aback7 to 1, aback15 to 8): these bits indicate that a transmit message in the corresponding mailbox (buffer) has been canceled (aborted) normally. bit x: abackx description 0 [clearing condition] writing 1 (initial value) 1 completion of transmit message cancellation for corresponding mailbox ? bit 8 reserved: this bit always reads 0. the write value should always be 0.
516 15.2.9 receive complete register (rxpr) the receive complete register (rxpr) is a 16-bit readable/writable register containing status flags that indicate normal reception of messages (data frame or remote frame) in mailboxes (buffers). in the case of remote frame reception, the corresponding bit in the remote request register (rfpr) is also set. bit: 15 14 13 12 11 10 9 8 rxpr7 rxpr6 rxpr5 rxpr4 rxpr3 rxpr2 rxpr1 rxpr0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 rxpr15 rxpr14 rxpr13 rxpr12 rxpr11 rxpr10 rxpr9 rxpr8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 0 receive complete register (rxpr7 to 0, rxpr15 to 8): these bits indicate that a receive message has been received normally in the corresponding mailbox (buffer). bit x: rxprx description 0 [clearing condition] writing 1 (initial value) 1 completion of message (data frame or remote frame) reception in corresponding mailbox
517 15.2.10 remote request register (rfpr) the remote request register (rfpr) is a 16-bit readable/writable register containing status flags that indicate normal reception of remote frames in mailboxes (buffers). when a bit in this register is set, the corresponding bit in the receive complete register (rxpr) is also set. bit: 15 14 13 12 11 10 9 8 rfpr7 rfpr6 rfpr5 rfpr4 rfpr3 rfpr2 rfpr1 rfpr0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 rfpr15 rfpr14 rfpr13 rfpr12 rfpr11 rfpr10 rfpr9 rfpr8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 0 remote request register (rfpr7 to 0, rfpr15 to 8): these bits indicate that a remote frame has been received normally in the corresponding mailbox (buffer). bit x: rfprx description 0 [clearing condition] writing 1 (initial value) 1 completion of remote frame reception in corresponding mailbox 15.2.11 interrupt register (irr) the interrupt register (irr) is a 16-bit readable/writable register containing status flags for the various interrupt sources. bit: 15 14 13 12 11 10 9 8 irr7 irr6 irr5 irr4 irr3 irr2 irr1 irr0 initial value: 0 0 0 0 0 0 0 1 r/w: r/w r/w r/w r/w r/w r r r/w bit: 7 6 5 4 3 2 1 0 ??? irr12 ?? irr9 irr8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r/w r r r/w r/w
518 ? bit 15 overload frame/bus off recovery interrupt flag (irr7): status flag indicating that the hcan has transmitted an overload frame or recovered from the bus off state. bit 15: irr7 description 0 [clearing condition] writing 1 (initial value) 1 overload frame transmission or recovery from bus off state [setting conditions] error active/error passive state ? when overload frame is transmitted bus off state ? when 11 recessive bits is received 128 times (rec 128) ? bit 14 bus off interrupt flag (irr6): status flag indicating the bus off state caused by the transmit error counter. bit 14: irr6 description 0 [clearing condition] writing 1 (initial value) 1 bus off state caused by transmit error [setting condition] when tec 256 ? bit 13 error passive interrupt flag (irr5): status flag indicating the error passive state caused by the transmit/receive error counter. bit 13: irr5 description 0 [clearing condition] writing 1 (initial value) 1 error passive state caused by transmit/receive error [setting condition] when tec 128 or rec 128
519 ? bit 12 receive overload warning interrupt flag (irr4): status flag indicating the error warning state caused by the receive error counter. bit 12: irr4 description 0 [clearing condition] writing 1 (initial value) 1 error warning state caused by receive error [setting condition] when rec 96 ? bit 11 transmit overload warning interrupt flag (irr3): status flag indicating the error warning state caused by the transmit error counter. bit 11: irr3 description 0 [clearing condition] writing 1 (initial value) 1 error warning state caused by transmit error [setting condition] when tec 96 ? bit 10 remote frame request interrupt flag (irr2): status flag indicating that a remote frame has been received in a mailbox (buffer). bit 10: irr2 description 0 [clearing condition] clearing of all bits in rfpr (remote request wait register) (initial value) 1 remote frame received and stored in mailbox [setting conditions] when remote frame reception is completed. when corresponding mbimr = 0. ? bit 9 receive message interrupt flag (irr1): status flag indicating that a mailbox (buffer) receive message has been received normally. bit 9: irr1 description 0 [clearing condition] clearing of all bits in rxpr (receive complete register) when mbimr is 0 (initial value) 1 data frame or remote frame received and stored in mailbox [setting conditions] when data frame or remote frame reception is completed. when corresponding mbimr = 0.
520 ? bit 8 reset interrupt flag (irr0): status flag indicating that the hcan module has been reset. this bit cannot be masked in the interrupt mask register (imr). if this bit is not cleared after a power-on reset or a transition to software standby mode, the program will jump to the interrupt vector as soon as interrupts are enabled by the interrupt controller. bit 8: irr0 description 0 [clearing condition] writing 1 1 interrupt request by power-on reset or transition to software standby mode (ovr) (initial value) [setting condition] when reset processing is completed after power-on reset or software standby mode transition ? bits 7 to 5, 3, and 2 reserved: these bits always read 0. the write value should always be 0. ? bit 4 bus operation interrupt flag (irr12): status flag indicating detection of a dominant bit due to bus operation when the hcan module is in hcan sleep mode. bit 4: irr12 description 0 can bus idle state (initial value) [clearing condition] writing 1 1 can bus operation in hcan sleep mode [setting condition] bus operation (dominant bit detection) in hcan sleep mode ? bit 1 unread interrupt flag (irr9): status flag indicating that a receive message has been overwritten while still unread. bit 1: irr9 description 0 [clearing condition] clearing of all bits in umsr (unread message status register) (initial value) 1 unread message overwrite [setting condition] when umsr (unread message status register) is set
521 ? bit 0 mailbox empty interrupt flag (irr8): status flag indicating that the next transmit message can be stored in the mailbox. bit 0: irr8 description 0 [clearing condition] writing 1 (initial value) 1 transmit message has been transmitted or aborted, and new message can be stored [setting condition] when txpr (transmit wait register) is cleared by completion of transmission or completion of transmission abort 15.2.12 mailbox interrupt mask register (mbimr) the mailbox interrupt mask register (mbimr) is a 16-bit readable/writable register containing flags that enable or disable individual mailbox (buffer) interrupt requests. bit: 15 14 13 12 11 10 9 8 mbimr7 mbimr6 mbimr5 mbimr4 mbimr3 mbimr2 mbimr1 mbimr0 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 mbimr15 mbimr14 mbimr13 mbimr12 mbimr11 mbimr10 mbimr9 mbimr8 initial value: 1 1 1 1 1 1 1 1 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 0 mailbox interrupt mask (mbimr7 to 0, mbimr15 to 8): flags that enable or disable individual mailbox interrupt requests. bit x: mbimrx description 0 [transmitting] interrupt request to cpu due to txpr clearing [receiving] interrupt request to cpu due to rxpr setting 1 interrupt requests to cpu disabled (initial value)
522 15.2.13 interrupt mask register (imr) the interrupt mask register (imr) is a 16-bit readable/writable register containing flags that enable or disable requests by individual interrupt sources. bit: 15 14 13 12 11 10 9 8 imr7 imr6 imr5 imr4 imr3 imr2 imr1 ? initial value: 1 1 1 1 1 1 1 0 r/w: r/w r/w r/w r/w r/w r/w r/w ? bit: 7 6 5 4 3 2 1 0 ??? imr12 ?? imr9 imr8 initial value: 1 1 1 1 1 1 1 1 r/w: r r r r/w r r r/w r/w ? bit 15 overload frame/bus off recovery interrupt mask (imr7): enables or disables overload frame/bus off recovery interrupt requests. bit 15: imr7 description 0 overload frame/bus off recovery interrupt request (ovr) by irr7 to cpu enabled 1 overload frame/bus off recovery interrupt request (ovr) by irr7 to cpu disabled (initial value) ? bit 14 bus off interrupt mask (imr6): enables or disables bus off interrupt requests caused by the transmit error counter. bit 14: imr6 description 0 bus off interrupt request (ers) by irr6 to cpu enabled 1 bus off interrupt request (ers) by irr6 to cpu disabled (initial value) ? bit 13 error passive interrupt mask (imr5): enables or disables error passive interrupt requests caused by the transmit/receive error counter. bit 13: imr5 description 0 error passive interrupt request (ers) by irr5 to cpu enabled 1 error passive interrupt request (ers) by irr5 to cpu disabled (initial value)
523 ? bit 12 receive overload warning interrupt mask (imr4): enables or disables error warning interrupt requests caused by the receive error counter. bit 12: imr4 description 0 rec error warning interrupt request (ovr) by irr4 to cpu enabled 1 rec error warning interrupt request (ovr) by irr4 to cpu disabled (initial value) ? bit 11 transmit overload warning interrupt mask (imr3): enables or disables error warning interrupt requests caused by the transmit error counter. bit 11: imr3 description 0 tec error warning interrupt request (ovr) by irr3 to cpu enabled 1 tec error warning interrupt request (ovr) by irr3 to cpu disabled (initial value) ? bit 10 remote frame request interrupt mask (imr2): enables or disables remote frame reception interrupt requests. bit 10: imr2 description 0 remote frame reception interrupt request (ovr) by irr2 to cpu enabled 1 remote frame reception interrupt request (ovr) by irr2 to cpu disabled (initial value) ? bit 9 receive message interrupt mask (imr1): enables or disables message reception interrupt requests. bit 9: imr1 description 0 message reception interrupt request (rm) by irr1 to cpu enabled 1 message reception interrupt request (rm) by irr1 to cpu disabled (initial value) ? bit 8 reserved: this bit always reads 0. the write value should always be 0. ? bits 7 to 5, 3, and 2 reserved: these bits always read 1. the write value should always be 1.
524 ? bit 4 bus operation interrupt mask (imr12): enables or disables interrupt requests due to bus operation in sleep mode. bit 4: imr12 description 0 bus operation interrupt request (ovr) by irr12 to cpu enabled 1 bus operation interrupt request (ovr) by irr12 to cpu disabled (initial value) ? bit 1 unread interrupt mask (imr9): enables or disables unread receive message overwrite interrupt requests. bit 1: imr9 description 0 unread message overwrite interrupt request (ovr) by irr9 to cpu enabled 1 unread message overwrite interrupt request (ovr) by irr9 to cpu disabled (initial value) ? bit 0 mailbox empty interrupt mask (imr8): enables or disables mailbox empty interrupt requests. bit 0: imr8 description 0 mailbox empty interrupt request (sle) by irr8 to cpu enabled 1 mailbox empty interrupt request (sle) by irr8 to cpu disabled (initial value) 15.2.14 receive error counter (rec) the receive error counter (rec) is an 8-bit read-only register that functions as a counter indicating the number of receive message errors on the can bus. the count value is stipulated in the can protocol. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r
525 15.2.15 transmit error counter (tec) the transmit error counter (tec) is an 8-bit read-only register that functions as a counter indicating the number of transmit message errors on the can bus. the count value is stipulated in the can protocol. bit: 7 6 5 4 3 2 1 0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r 15.2.16 unread message status register (umsr) the unread message status register (umsr) is a 16-bit readable/writable register containing status flags that indicate, for individual mailboxes (buffers), that a received message has been overwritten by a new receive message before being read. when an unread message is overwritten by a new receive message, the old data is lost. bit: 15 14 13 12 11 10 9 8 umsr7 umsr6 umsr5 umsr4 umsr3 umsr2 umsr1 umsr0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 umsr15 umsr14 umsr13 umsr12 umsr11 umsr10 umsr9 umsr8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 to 0 unread message status flags (umsr7 to 0, umsr15 to 8): status flags indicating that an unread receive message has been overwritten. bit x: umsrx description 0 [clearing condition] writing 1 (initial value) 1 unread receive message is overwritten by a new message [setting condition] when a new message is received before rxpr is cleared
526 15.2.17 local acceptance filter masks (lafml, lafmh) the local acceptance filter masks (lafml, lafmh) are 16-bit readable/writable registers that filter receive messages to be stored in the receive-only mailbox (mc0, md0) according to the identifier. in these registers, consist of lafmh15: msb to lafmh5: lsb are 11 standard/extended identifier bits, and lafmh1: msb to lafml0: lsb are 18 extended identifier bits. lafml bit: 15 14 13 12 11 10 9 8 lafml7 lafml6 lafml5 lafml4 lafml3 lafml2 lafml1 lafml0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 lafml15 lafml14 lafml13 lafml12 lafml11 lafml10 lafml9 lafml8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w lafmh bit: 15 14 13 12 11 10 9 8 lafmh7 lafmh6 lafmh5 ?? ? lafmh1 lafmh0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r r r r/w r/w bit: 7 6 5 4 3 2 1 0 lafmh15 lafmh14 lafmh13 lafmh12 lafmh11 lafmh10 lafmh9 lafmh8 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? lafmh bits 7 to 0 and 15 to 13 11-bit identifier filter (lafmh7 to 5, lafmh15 to 8): filter mask bits for the first 11 bits of the receive message identifier (for both standard and extended identifiers).
527 bit x: lafmhx description 0 stored in mc0 and md0 (receive-only mailbox) depending on bit match between mc0 message identifier and receive message identifier (initial value) 1 stored in mc0 and md0 (receive-only mailbox) regardless of bit match between mc0 message identifier and receive message identifier ? lafmh bits 12 to 10 reserved: these bits always read 0. the write value should always be 0. ? lafmh bits 9 and 8, lafml bits 15 to 0 18-bit identifier filter (lafmh1, 0, lafml15 to 0): filter mask bits for the 18 bits of the receive message identifier (extended). bit x: lafmhx lafmlx description 0 stored in mc0 and md0 (receive-only mailbox) depending on bit match between mc0 message identifier and receive message identifier (initial value) 1 stored in mc0 and md0 (receive-only mailbox) regardless of bit match between mc0 message identifier and receive message identifier 15.2.18 message control (mc0 to mc15) the message control register sets (mc0 to mc15) consist of eight 8-bit readable/writable registers (mcx[1] to mcx[8]). the hcan has 16 sets of these registers (mc0 to mc15). the initial value of these registers is undefined, so they must be initialized (by writing 0 or 1). mcx [1] bit: 7 6 5 4 3 2 1 0 dlc3 dlc2 dlc1 dlc0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mcx [2] bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w
528 mcx [3] bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mcx [4] bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mcx [5] bit: 7 6 5 4 3 2 1 0 std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mcx [6] bit: 7 6 5 4 3 2 1 0 std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mcx [7] bit: 7 6 5 4 3 2 1 0 exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mcx [8] bit: 7 6 5 4 3 2 1 0 exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w
529 ? mcx[1] bits 7 to 4 reserved: the initial value of these bits is undefined; they must be initialized (by writing 0 or 1). ? mcx[1] bits 3 to 0: data length code (dlc3 to 0): these bits indicate the required length of data frames and remote frames. bit 3: dlc3 bit 2: dlc2 bit 1: dlc1 bit 0: dlc0 description 0000 data length = 0 bytes 1 data length = 1 byte 1 0 data length = 2 bytes 1 data length = 3 bytes 1 0 0 data length = 4 bytes 1 data length = 5 bytes 1 0 data length = 6 bytes 1 data length = 7 bytes 1 *** data length = 8 bytes * : don ? t care ? mcx[2] bits 7 to 0 reserved: the initial value of these bits is undefined; they must be initialized (by writing 0 or 1). ? mcx[3] bits 7 to 0 reserved: the initial value of these bits is undefined; they must be initialized (by writing 0 or 1). ? mcx[4] bits 7 to 0 reserved: the initial value of these bits is undefined; they must be initialized (by writing 0 or 1). ? mcx[6] bits 7 to 0: standard identifier (std_id10 to std_id3) mcx[5] bits 7 to 5: standard identifier (std_id2 to std_id0) these bits set the identifier (standard identifier) of data frames and remote frames. standard identifier sof id10 id9 id8 id7 id6 id5 id4 id3 id2 id1 id0 rtr std_idxx ide srr figure 15.3 standard identifier
530 ? mcx[5] bit 4: remote transmission request (rtr): used to distinguish between data frames and remote frames. bit 4: rtr description 0 data frame 1 remote frame ? mcx[5] bit 3: identifier extension (ide): used to distinguish between the standard format and extended format of data frames and remote frames. bit 3: ide description 0 standard format 1 extended format ? mcx[5] bit 2 reserved: the initial value of this bit is undefined; it must be initialized (by writing 0 or 1). ? mcx[5] bits 1 and 0: extended identifier (exd_id17, exd_id16) mcx[8] bits 7 to 0: extended identifier (exd_id15 to exd_id8) mcx[7] bits 7 to 0: extended identifier (exd_id7 to exd_id0) these bits set the identifier (extended identifier) of data frames and remote frames. extended identifier ide id17 id16 id15 id14 id13 id12 id11 id10 id9 id8 id7 id6 id5 exd_idxx id4 id3 id2 id1 id0 rtr r1 exd_idxx figure 15.4 extended identifier
531 15.2.19 message data (md0 to md15) the message data register sets (md0 to md15) consist of eight 8-bit readable/writable registers (mdx[1] to mdx[8]). the hcan has 16 sets of these registers (md0 to md15). the initial value of these registers is undefined, so they must be initialized (by writing 0 or 1). mdx[1] message data 1 bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mdx[2] message data 2 bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mdx[3] message data 3 bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mdx[4] message data 4 bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mdx[5] message data 5 bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w
532 mdx[6] message data 6 bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mdx[7] message data 7 bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w mdx[8] message data 8 bit: 7 6 5 4 3 2 1 0 initial value: ???????? r/w: r/w r/w r/w r/w r/w r/w r/w r/w
533 15.3 operation 15.3.1 hardware reset and software reset there are two ways of resetting the hcan: hardware reset, software reset hardware reset (power-on reset or hardware/software standby): the mcr reset request bit (mcr0) in mcr and the reset state bit (gsr3) in gsr within the hcan are automatically set and initialization is performed. at the same time, all internal registers are initialized. however mailbox (ram) contents are not initialized. a flowchart of this reset is shown in figure 15.5. software reset: in normal operation, hcan is initialized by setting the mcr reset request bit (mcr0) in mcr. with this kind of reset, if the can controller is performing a communication operation (transmission or reception), the initialization state is not entered until the message has been completed. during initialization, the reset state bit (gsr3) in gsr is set. in this kind of initialization, the error counters (tec and rec) are initialized but other registers and ram are not. a flowchart of this reset is shown in figure 15.6.
534 irr0 = 1 (automatic) gsr3 = 1 (automatic) initialization of hcan module clear irr0 hcan port setting bcr setting mbcr setting mailbox initialization message transmission method initialization hardware reset mcr0 = 1 (automatic) gsr3 = 0? gsr3 = 0 & 11 recessive bits received? can bus communication enabled imr setting (interrupt mask setting) mbimr setting (interrupt mask setting) mc[x] setting (receive identifier setting) lafm setting (receive identifier mask setting) mcr0 = 0 bit configuration mode period in which bcr, mbcr, etc., are initialized : settings by user : processing by hardware yes yes no no figure 15.5 hardware reset flowchart
535 initialization of rec and tec only mcr0 = 1 gsr3 = 1 (automatic) bus idle? can bus communication enabled : settings by user : processing by hardware yes yes no no mcr0 = 0 gsr3 = 0? no imr setting mbimr setting mc[x] setting lafm setting ok? no yes yes yes correction correction no irr clearing hcan port setting bcr setting mbcr setting mailbox initialization message transmission method initialization ok? gsr3 = 0 & 11 recessive bits received? figure 15.6 software reset flowchart
536 15.3.2 initialization after a hardware reset after a hardware reset, the following initialization processing should be carried out: 1. irr0 clearing 2. hcan pin port settings 3. bit rate setting 4. mailbox transmit/receive settings 5. mailbox (ram) initialization 6. message transmission method setting these initial settings must be made while the hcan is in bit configuration mode. configuration mode is a state in which the reset request bit (mcr0) in the master control register (mcr) is 1 and the reset status bit in the general status register (gsr) is also 1 (gsr3 = 1). configuration mode is exited by clearing the reset request bit in mcr to 0; when mcr0 is cleared to 0, the hcan automatically clears the reset state bit (gsr3) in the general status register (gsr). the power-up sequence then begins, and communication with the can bus is possible as soon as the sequence ends. the power-up sequence consists of the detection of 11 consecutive recessive bits. irr0 clearing: the reset interrupt flag (irr0) is always set after a power-on reset or recovery from software standby mode. as an hcan interrupt is initiated immediately when interrupts are enabled, irr0 should be cleared. hcan pin port settings: hcan pin port settings must be made during or before bit configuration. refer to the section 18, pin function controller (pfc), for details of the setting method. bit rate settings: as bit rate settings, a baud rate setting and bit timing setting must be made each time a can node begins communication. the baud rate and bit timing settings are made in the bit configuration register (bcr). notes: 1. bcr can be written to at all times, but should only be modified in configuration mode. 2. settings should be made so that all can controllers connected to the can bus have the same baud rate and bit width. 3. limits for the settable variables (tseg1, tseg2, brp, sample point, and sjw) are shown in table 15.4.
537 table 15.4 bcr setting limits name abbreviation min. value max. value unit time segment 1 tseg1 4 16 tq time segment 2 tseg2 2 8 tq baud rate prescaler brp 2 128 system clock sample point sam 1 3 point re-synchronization jump width sjw 1 4 tq settable variable limits ? the bit width consists of the total of the settable time quanta (tq). tq (number of system clocks) is determined by the baud rate prescaler (brp). tq = (2*(brp + 1))/(f clk ) f clk = p ? the minimum value of sjw is stipulated in the can specifications. 4 sjw 1 ? the minimum value of tseg1 is stipulated in the can specifications. tseg1 tseg2 ? the minimum value of tseg2 is stipulated in the can specifications. tseg2 (1 + sjw) the following formula is used to calculate the baud rate. f clk 2 (brp + 1) (3 + tseg1 + tseg2) bit rate [b/s] = note: f clk = p (peripheral clock: /2] the bcr values are used for brp, tseg1, and tseg2.
538 example: with a 1 mb/s baud rate and a 40 mhz input clock: 20 mhz 2 (0 + 1) (3 + 4 + 3) 1 mb/s = set values actual values f clk 40 mhz/2 ? brp 0 (b'000000) system clock 2 tseg1 4 (b'0100) 5tq tseg2 3 (b'011) 4tq mailbox transmit/receive settings: hcan0 and hcan1 each have 16 mailboxes. mailbox 0 is receive-only, while mailboxes 1 to 15 can be set for transmission or reception. mailboxes that can be set for transmission or reception must be designated either for transmission use or for reception use before communication begins. the initial status of mailboxes 1 to 15 is for transmission (while mailbox 0 is for reception only). mailbox transmit/receive settings are not initialized by a software reset. ? setting for transmission transmit mailbox setting (mailboxes 1 to 15) clearing a bit to 0 in the mailbox configuration register (mbcr) designates the corresponding mailbox for transmission use. after a reset, mailboxes are initialized for transmission use, so this setting is not necessary. ? setting for reception transmit/receive mailbox setting (mailboxes 1 to 15) setting a bit to 1 in the mailbox configuration register (mbcr) designates the corresponding mailbox for reception use. when setting mailboxes for reception, to improve message transmission efficiency, high-priority messages should be set in low-to-high mailbox order (priority order: mailbox 1 (mcx[1]) > mailbox 15 (mcx[15])). ? receive-only mailbox (mailbox 0) no setting is necessary, as this mailbox is always used for reception. mailbox (message control/data (mcx[x], mdx[x]) initial settings: after power is supplied, all registers and ram (message control/data, control registers, status registers, etc.) are initialized. message control/data (mcx[x], mdx[x]) only are in ram, and so their values are undefined. initial values must therefore be set in all the mailboxes (by writing 0s or 1s). setting the message transmission method: either of the following message transmission methods can be selected with the message transmission method bit (mcr2) in the master control register (mcr):
539 1. transmission order determined by mailbox number priority 2. transmission order determined by message identifier priority when the mailbox number priority method is selected, if a number of messages are designated as waiting for transmission (txpr = 1), messages are stored in the transmit buffer in low-to-high mailbox order (priority order: mailbox 1 > 15). can bus arbitration is then carried out for the messages in the transmit buffer, and message transmission is performed when the bus is acquired. when the message identifier priority method is selected, if a number of messages are designated as waiting for transmission (txpr = 1), the message with the highest priority set in the message identifier (mcx[5] to mcx[8]) is stored in the transmit buffer. can bus arbitration is then carried out for the message in the transmit buffer, and message transmission is performed when the transmission right is acquired. when the txpr bit is set, internal arbitration is performed again, and the highest-priority message is found and stored in the transmit buffer. 15.3.3 transmit mode message transmission is performed using mailboxes 1 to 15. the transmission procedure is described below, and a transmission flowchart is shown in figure 15.7. 1. initialization (after hardware reset only) a. clearing of irr0 bit in interrupt register (irr) b. hcan pin port settings c. bit rate settings d. mailbox transmit/receive settings e. mailbox initialization f. message transmission method setting 2. interrupt and transmit data settings a. interrupt setting b. arbitration field setting c. control field setting d. data field setting 3. message transmission and interrupts a. message transmission wait b. message transmission completion and interrupt c. message transmission abort d. message retransmission
540 initialization (after hardware reset only): these settings should be made while the hcan is in bit configuration mode. 1. irr0 clearing the reset interrupt flag (irr0) is always set after a power-on reset or recovery from software standby mode. as an hcan interrupt is initiated immediately when interrupts are enabled, irr0 should be cleared. 2. hcan pin port settings to prevent erroneous identification of can bus data, hcan pin port settings should be made first. see section 15.3.2, hcan pin port settings, and section 18, pin function controller, for details. 3. bit rate settings set values relating to the can bus communication speed and re-synchronization. see section 15.3.2, bit rate settings, for details. 4. mailbox transmit/receive settings mailbox transmit/receive settings should be made in advance. a total of 30 mailbox can be set for transmission or reception (mailboxes 1 to 15 in hcan0 and hcan1). to set a mailbox for transmission, clear the corresponding bit to 0 in the mailbox configuration register (mbcr). see section 15.3.2, mailbox transmit/receive settings, for details. 5. mailbox initialization as message control/data registers (mcx[x], mdx[x]) are configured in ram, their initial values after powering on are undefined, and so bit initialization is necessary. write 0s or 1s to the mailboxes. see section 15.3.2, mailbox transmit/receive settings, for details. 6. message transmission method setting set the transmission method for mailboxes designated for transmission. the following two transmission methods can be used. see section 15.3.2, setting the message transmission method, for details. a. transmission order determined by message identifier priority b. transmission order determined by mailbox number priority
541 initialization (after hardware reset only) irr0 clearing hcan port setting bcr setting mbcr setting mailbox initialization message transmission method setting interrupt settings transmit data setting arbitration field setting control field setting data field setting message transmission wait txpr setting bus idle? no message transmission gsr2 = 0 (during transmission only) transmission completed? no imr8 = 1? yes interrupt to cpu clear txack clear irr8 end of transmission : settings by user : processing by hardware yes yes no txack = 1? no yes figure 15.7 transmission flowchart
542 interrupt and transmit data settings: when mailbox initialization is finished, cpu interrupt source settings and data settings must be made. interrupt source settings are made in the mailbox interrupt mask register (mbimr) and interrupt mask register (imr), while transmit data settings are made by writing the following three kinds of necessary data in the message control registers (mcx[1] to mcx[8]) and message data registers (mdx[1] to mdx[8]). 1. cpu interrupt source settings transmission acknowledge and transmission abort acknowledge interrupts can be masked for individual mailboxes in the mailbox interrupt mask register (mbimr). interrupt register (irr) interrupts can be masked in the interrupt mask register (imr). 2. arbitration field in the arbitration field, the 11-bit identifier (std_id0 to std_id10) and rtr bit (standard format) or 29-bit identifier (std_id0 to std_id10, ext_id0 to ext_id17) and ide.rtr bit (extended format) are set. the registers to be set are mcx[5] to mcx[8]. 3. control field in the control field, the byte length of the data to be transmitted is set in dlc0 to dlc3. the register to be set is mcx[1]. 4. data field in the data field, the data to be transmitted is set in byte units in the range of 0 to 8 bytes. the registers to be set are mdx[1] to mdx[8]. the number of bytes in the data actually transmitted depends on the data length code (dlc) in the control field. if a value exceeding the value set in dlc is set in the data field, only the number of bytes set in dlc will actually be transmitted.
543 message transmission and interrupts: 1. message transmission wait if message transmission is to be performed after completion of the message control (mcx[1] to mcx[8]) and message data (mdx[1] to mdx[8]) settings, transmission is started by setting the corresponding mailbox transmit wait bit (txpr1 to txpr15) to 1 in the transmit wait register (txpr). the following two transmission methods can be used: a. transmission order determined by mailbox number priority b. transmission order determined by message identifier priority when the message identifier priority method is selected, if a number of messages are designated as waiting for transmission (txpr = 1), messages are stored in the transmit buffer in low-to-high mailbox order (priority order: mailbox 1 > mailbox 15). can bus arbitration is then carried out for the messages in the transmit buffer, and message transmission is performed when the bus is acquired. when the mailbox number priority method is selected, if a number of messages are designated as waiting for transmission (txpr = 1), the message with the highest priority set in the message identifier (mcx[5] to mcx[8]) is stored in the transmit buffer. can bus arbitration is then carried out for the message in the transmit buffer, and message transmission is performed when the transmission right is acquired. when the txpr bit is set, internal arbitration is performed again, the highest-priority message is found and stored in the transmit buffer, can bus arbitration is carried out in the same way, and message transmission is performed when the transmission right is acquired. 2. message transmission completion and interrupt when a message is transmitted error-free using the above procedure, the corresponding acknowledge bit (txack1 to txack15) in the transmit acknowledge register (txack) and transmit wait bit (txpr1 to txpr15) in the transmit wait register (txpr) are automatically initialized. if the corresponding bit (mbimr1 to mbimr15) in the mailbox interrupt mask register (mbimr) and the mailbox empty interrupt bit (irr8) in the interrupt mask register (imr) are set to the interrupt enable value at this time, an interrupt can be sent to the cpu. 3. message transmission cancellation transmission cancellation can be specified for a message stored in a mailbox as a transmit wait message. a transmit wait message is canceled by setting the bit for the corresponding mailbox (txcr1 to txcr15) to 1 in the transmit cancel register (txcr). when cancellation is executed, the transmit wait register (txpr) is automatically reset, and the corresponding bit is set to 1 in the abort acknowledge register (aback). an interrupt can be requested. if the corresponding bit (mbimr1 to mbimr15) in the mailbox interrupt mask register (mbimr) and the mailbox empty interrupt bit (irr8) in the interrupt mask register (imr) are set to the interrupt enable value at this time, an interrupt can be sent to the cpu.
544 however, a transmit wait message cannot be canceled at the following times: a. during internal arbitration or can bus arbitration b. during data frame or remote frame transmission also, transmission cannot be canceled by clearing the transmit wait register (txpr). figure 15.8 shows a flowchart of transmit message cancellation. 4. message retransmission if transmission of a transmit message is aborted in the following cases, the message is retransmitted automatically: a. can bus arbitration failure (failure to acquire the bus) b. error during transmission (bit error, stuff error, crc error, frame error, ack error)
545 message transmit wait txpr setting set txcr bit corresponding to message to be canceled cancellation possible? no message not sent clear txcr, txpr aback = 1 irr8 = 1 imr8 = 1? yes interrupt to cpu clear txack clear aback clear irr8 end of transmission/transmission cancellation completion of message transmission txack = 1 clear txcr, txpr irr8 = 1 yes no : settings by user : processing by hardware figure 15.8 transmit message cancellation flowchart
546 15.3.4 receive mode message reception is performed using mailboxes 0 and 1 to 15. the reception procedure is described below, and a reception flowchart is shown in figure 15.9. 1. initialization (after hardware reset only) a. clearing of irr0 bit in interrupt register (irr) b. hcan pin port settings c. bit rate settings d. mailbox transmit/receive settings e. mailbox initialization 2. interrupt and receive message settings a. interrupt setting b. arbitration field setting c. local acceptance filter mask (lafm) settings 3. message reception and interrupts a. message reception crc check b. data frame reception c. remote frame reception d. unread message reception
547 initialization (after hardware reset only): these settings should be made while the hcan is in bit configuration mode. 1. irr0 clearing the reset interrupt flag (irr0) is always set after a power-on reset or recovery from software standby mode. as an hcan interrupt is initiated immediately when interrupts are enabled, irr0 should be cleared. 2. hcan pin port settings to prevent erroneous identification of can bus data, hcan pin port settings should be made first. see section 15.3.2, hcan pin port settings, and section 18, pin function controller, for details. 3. bit rate settings set values relating to the can bus communication speed and re-synchronization. see section 15.3.2, bit rate settings, for details. 4. mailbox transmit/receive settings each channel has one receive-only mailbox (mailbox 0) and 15 mailboxes that can be set for reception. thus a total of 32 mailboxes can be used for reception. to set a mailbox for reception, set the corresponding bit to 1 in the mailbox configuration register (mbcr). the initial setting for mailboxes is 0, designating transmission use. see section 15.3.2, mailbox transmit/receive settings, for details. 5. mailbox (ram) initialization as message control/data registers (mcx[x], mdx[x]) are configured in ram, their initial values after powering on are undefined, and so bit initialization is necessary. write 0s or 1s to the mailboxes. see section 15.3.2, mailbox (message control/data (mcx[x], mdx[x]) initial settings, for details.
548 initialization irr0 clearing hcan port setting bcr setting mbcr setting mailbox (ram) initialization interrupt settings receive data setting arbitration field setting local acceptance filter settings message reception (match of identifier in mailbox?) no same rxpr = 1? yes data frame? no rxpr irr1 = 1 yes imr1 = 1? interrupt to cpu message control read message data read clear pxpr yes no yes no no rxpr = 1? yes yes no rxpr = 1? yes rxpr, rfpr = 1 irr2 = 1, irr1 = 1 imr2 = 1? interrupt to cpu message control read message data read clear rxpr, rfpr transmission of data frame corresponding to remote frame no : settings by user : processing by hardware end of reception unread message figure 15.9 reception flowchart
549 interrupt and receive message settings: when mailbox initialization is finished, cpu interrupt source settings and receive message specifications must be made. interrupt source settings are made in the mailbox interrupt mask register (mbimr) and interrupt mask register (imr). to receive a message, the identifier must be set in advance in the message control (mcx[1] to mcx[8]) for the receiving mailbox. when a message is received, all the bits in the receive message identifier are compared, and if a 100% match is found, the message is stored in the matching mailbox. mailbox 0 (mc0[x], md0[x]) has a local acceptance filter mask (lafm) that allows don t care settings to be made. 1. cpu interrupt source settings when transmitting, transmission acknowledge and transmission abort acknowledge interrupts can be masked for individual mailboxes in the mailbox interrupt mask register (mbimr). when receiving, data frame and remote frame receive wait interrupts can be masked. interrupt register (irr) interrupts can be masked in the interrupt mask register (imr). 2. arbitration field setting in the arbitration field, the identifier (std_id0 to std_id10, ext_id0 to ext_id17) of the message to be received is set. if all the bits in the set identifier do not match, the message is not stored in a mailbox. example: mailbox 1 010_1010_1010 (standard identifier) only one kind of message identifier can be received by mb1 identifier 1: 010_1010_1010 3. local acceptance filter mask (lafm) setting the local acceptance filter mask is provided for mailbox 0 (mc0[x], md0[x]) only, enabling a don t care specification to be made for all bits in the received identifier. this allows various kinds of messages to be received. example: mailbox 0 010_1010_1010 (standard identifier) lafm 000_0000_0011 (0: care, 1: don t care) a total of four kinds of message identifiers can be received by mb0 identifier 1: 010_1010_1000 identifier 2: 010_1010_1001 identifier 3: 010_1010_1010 identifier 4: 010_1010_1011
550 message reception and interrupts: 1. message reception crc check when a message is received, a crc check is performed automatically (by hardware). if the result of the crc check is normal, ack is transmitted in the ack field irrespective of whether or not the message can be received. 2. data frame reception if the received message is confirmed to be error-free by the crc check, etc., the identifier in the mailbox (and also lafm in the case of mailbox 0 only) and the identifier of the receive message are compared, and if a complete match is found, the message is stored in the mailbox. the message identifier comparison is carried out on each mailbox in turn, starting with mailbox 0 and ending with mailbox 15. if a complete match is found, the comparison ends at that point, the message is stored in the matching mailbox, and the corresponding receive complete bit (rxpr0 to rxpr15) is set in the receive complete register (rxpr). however, when a mailbox 0 lafm comparison is carried out, even if the identifier matches, the mailbox comparison sequence does not end at that point, but continues with mailbox 1 and then the remaining mailboxes. it is therefore possible for a message matching mailbox 0 to be received by another mailbox (however, the same message cannot be stored in more than one of mailboxes 1 to 15). if the corresponding bit (mbimr0 to mbimr15) in the mailbox interrupt mask register (mbimr) and the receive message interrupt mask (imr1) in the interrupt mask register (imr) are set to the interrupt enable value at this time, an interrupt can be sent to the cpu. 3. remote frame reception two kinds of messages data frames and remote frames can be stored in mailboxes. a remote frame differs from a data frame in that the remote reception request bit (rtr) in the message control register (mc[x]5) and the data field are 0 bytes. the data length to be returned in a data frame must be stored in the data length code (dlc) in the control field. when a remote frame (rtr = recessive) is received, the corresponding bit is set in the remote request wait register (rfpr). if the corresponding bit (mbimr0 to mbimr15) in the mailbox interrupt mask register (mbimr) and the remote frame request interrupt mask (irr2) in the interrupt mask register (imr) are set to the interrupt enable value at this time, an interrupt can be sent to the cpu.
551 4. unread message reception when the identifier in a mailbox matches a receive message, the message is stored in the mailbox. if a message overwrite occurs before the cpu reads the message, the corresponding bit (umsr0 to umsr15) is set in the unread message register (umsr). in overwriting of an unread message, when a new message is received before the corresponding bit in the receive complete register (rxpr) has been cleared, the unread message register (umsr) is set. if the unread interrupt flag (irr9) in the interrupt mask register (imr) is set to the interrupt enable value at this time, an interrupt can be sent to the cpu. figure 15.10 shows a flowchart of unread message overwriting. umsr = 1 irr9 = 1 unread message overwrite imr9 = 1? end yes interrupt to cpu clear irr9 message control/message data read no : settings by user : processing by hardware figure 15.10 unread message overwrite flowchart
552 15.3.5 hcan sleep mode the hcan is provided with an hcan sleep mode that places the hcan module in the sleep state to reduce current dissipation. figure 15.11 shows a flowchart of the hcan sleep mode. mcr5 = 1 bus operation? irr12 = 1 initialize tec and rec imr12 = 1? sleep mode clearing method mcr7 = 0? mcr5 = 0 can bus communication possible cpu interrupt mcr5 = 0 clear sleep mode? yes yes no bus idle? no yes no yes (manual) no (automatic) no yes yes no : settings by user : processing by hardware 11 recessive bits? figure 15.11 hcan sleep mode flowchart
553 hcan sleep mode is entered by setting the hcan sleep mode bit (mcr5) to 1 in the master control register (mcr). if the can bus is operating, the transition to hcan sleep mode is delayed until the bus becomes idle. either of the following methods of clearing hcan sleep mode can be selected by making a setting in the mcr7 bit. 1. clearing by software 2. clearing by can bus operation eleven recessive bits must be received after hcan sleep mode is cleared before can bus communication is enabled again. clearing by software: clearing by software is performed by having the cpu write 0 to mcr5. clearing by can bus operation: clearing by can bus operation occurs automatically when the can bus performs an operation and this change is detected. in this case, the first message is not received in the message box; normal reception starts with the second message. when a change is detected on the can bus in hcan sleep mode, the bus operation interrupt flag (irr12) is set in the interrupt register (irr). if the bus interrupt mask (imr12) in the interrupt mask register (imr) is set to the interrupt enable value at this time, an interrupt can be sent to the cpu.
554 15.3.6 hcan halt mode the hcan halt mode is provided to enable mailbox settings to be changed without performing an hcan hardware or software reset. figure 15.12 shows a flowchart of the hcan halt mode. mcr1 = 1 gsr2 = 1? (wait until transmission is completed if in progress) bus idle? can bus communication possible no mbcr setting mcr1 = 0 yes : settings by user : processing by hardware figure 15.12 hcan halt mode flowchart hcan halt mode is entered by setting the halt request bit (mcr1) to 1 in the master control register (mcr). if the can bus is operating, the transition to hcan halt mode is delayed until the bus becomes idle. hcan halt mode is cleared by clearing mcr1 to 0.
555 15.3.7 interrupt interface there are 12 interrupt sources for each hcan channel. four independent interrupt vectors are assigned to each channel. table 15.5 lists the hcan interrupt sources. with the exception of the power-on reset processing vector (irr0), these sources can be masked. masking is implemented using the mailbox interrupt mask register (mbimr) and interrupt mask register (imr). table 15.5 hcan interrupt sources channel ipr bits vector vector number irr bit description hcan iprl (11 to 8) ers 220 irr5 error passive interrupt (tec 128 or rec 128) (initial value) irr6 bus off interrupt (tec 256) ovr 221 irr0 power-on reset processing interrupt irr2 remote frame reception interrupt irr3 error warning interrupt (tec 96) irr4 error warning interrupt (rec 96) irr7 overload frame transmission interrupt/bus off recovery interrupt (11 recessive bits 128 times) irr9 unread message overwrite interrupt irr12 hcan sleep mode can bus operation interrupt rm0 222 irr1 mailbox 0 message reception interrupt irr1 mailbox 1 to 15 message reception interrupt sle0 223 irr8 message transmission/cancellation interrupt
556 15.3.8 dmac interface the dmac can be activated by reception of a message in hcan s mailbox 0. when dmac transfer ends after dmac activation has been set, the rxpr0 and rfpr0 flags are acknowledge signal automatically. an interrupt request due to a receive interrupt from the hcan cannot be sent to the cpu in this case. figure 15.13 shows a dmac transfer flowchart. end of dmac transfer? end no dmac initialization activation source setting source/destination address settings transfer count setting interrupt setting message reception in hcan ? s mailbox 0 dmac activation dmac transfer end bit setting rxpr and rfpr clearing dmac interrupt enabled? no interrupt to cpu clear dmac interrupt flag yes yes : settings by user : processing by hardware figure 15.13 dmac transfer flowchart
557 15.4 can bus interface a bus transceiver ic is necessary to connect the sh7052f/sh7053f/sh7054f chip to a can bus. a philips pca82c250 transceiver ic, or compatible device, is recommended. figure 15.14 shows a sample connection diagram. rs rxd txd vref n.c. vcc canh canl gnd hrxd htxd sh7052f/sh7053f/sh7054f can bus 124 ? 124 ? vcc pca82c250 figure 15.14 example of high-speed interface using pca82c250
558 15.5 usage notes 1. reset the hcan is reset by a power-on reset, and in hardware standby mode and software standby mode. all the registers are initialized in a reset, but mailboxes (message control (mcx[x])/message data (mdx[x]) are not. however, after powering on, mailboxes (message control (mcx[x])/message data (mdx[x]) are initialized, and their values are undefined. therefore, mailbox initialization must always be carried out after a power-on reset or a transition to hardware standby mode or software standby mode. the reset interrupt flag (irr0) is always set after a power-on reset or recovery from software standby mode. as this bit cannot be masked in the interrupt mask register (imr), if hcan interrupt enabling is set in the interrupt controller without clearing the flag, an hcan interrupt will be initiated immediately. irr0 should therefore be cleared during initialization. 2. hcan sleep mode the bus operation interrupt flag (irr12) in the interrupt register (irr) is set by bus operation in hcan sleep mode. therefore, this flag is not used by the hcan to indicate sleep mode release. also note that the reset status bit (gsr3) in the general status register (gsr) is set in sleep mode. 3. port settings port settings must be made with the pfc before the hcan begins can bus communication. when using the two hcan pins in a 2-channel/32-buffer configuration (wired-and), set the other two hcan pin locations as non-hcan. 4. dmac activation when the dmac is activated automatically by reception of a message in hcan0 s mailbox 0 (receive-only mailbox), a signal is not sent to the intc. 5. interrupts when the mailbox interrupt mask register (mbimr) is set, the interrupt register (irr8.2.1) is not set by reception completion, transmission completion, or transmission cancellation for the set mailboxes. 6. error counters in the case of error active and error passive, rec and tec normally count up and down. in the bus off state, 11-bit recessive sequences are counted (rec + 1) using rec. if rec reaches 96 during the count, irr4 and gsr1 are set, and if rec reaches 128, irr7 is set. 7. register access byte or word access can be used on all hcan registers. longword access cannot be used. 8. register initialization in standby modes all hcan registers are initialized in hardware standby mode and software standby mode.
559 section 16 a/d converter 16.1 overview the sh7052f/sh7053f/sh7054f includes a 10-bit successive-approximation a/d converter, with software selection of up to 32 analog input channels. the a/d converter is composed of two independent modules, a/d0 and a/d1. a/d0 comprises three groups and a/d1 comprises one group. module analog groups channels a/d0 analog group 0 an0 to an3 analog group 1 an4 to an7 analog group 2 an8 to an11 a/d1 analog group 3 an12 to an15 16.1.1 features the features of the a/d converter are summarized below. ? 10-bit resolution 16 input channels (a/d0: 12 channels, a/d1: 4 channels) ? high-speed conversion conversion time: minimum 13.4 ? per channel (when = 40 mhz) ? two conversion modes ? single mode: a/d conversion on one channel ? scan mode: cotinuous scan mode, single-cycle scan mode (an0 to an3, an4 to an7, an8 to an11, an12 to an15) continuous conversion on 1 to 12 channels (a/d0) continuous conversion on 1 to 4 channels (a/d1) ? sixteen 10-bit a/d data registers a/d conversion results are transferred for storage into data registers corresponding to the channels. ? two sample-and-hold circuits a sample-and-hold circuit is built into each a/d converter module (a/d0 and a/d1), simplifying the configuration of external analog input circuitry. ? a/d conversion interrupts and dma function supported
560 an a/d conversion interrupt request (adi) can be sent to the cpu at the end of a/d conversion (adi0: a/d0 interrupt request; adi1: a/d1 interrupt request). also, the dmac can be activated by an adi interrupt request. ? two kinds of conversion activation ? software or external trigger ( adter0 , atu-ii (itvrr2a)) can be selected (a/d0) ? software or external trigger ( adtgr0 , atu-ii (itvrr2b)) can be selected (a/d1)
561 16.1.2 block diagram figure 16.1 shows a block diagram of the a/d converter. a/d0 10-bit d/a addr0 to addr1 adcsr0 adcr0 adtrgr0 an0 an1 an2 an3 an4 an5 an6 an7 an8 an9 an10 an11 + comparator sample-and- hold circuit a/d conversion control circuit av cc av ss av ref module data bus module data bus adi0 interrupt signal adi1 interrupt signal atu0 adtrg0 figure 16.1 a/d converter block diagram
562 16.1.3 pin configuration table 16.1 summarizes the a/d converter? input pins. there are 16 analog input pins, an0 to an15. the 12 pins an0 to an11 are a/d0 analog inputs, divided into three groups: an0 to an3 (group 0), an4 to an7 (group 1), and an8 to an11 (group 2). the 4 pins an12 to an15 are a/d1 analog inputs, which is one group: an12 to an15 (group 3). the adtrg0 pin is used to provide a/d conversion start timing from off-chip. when a low level is applied to one of these pins, a/d0 or a/d1 starts conversion. the av cc and av ss pins are power supply voltage pins for the analog section in a/d converter modules a/d0 and a/d1. the av ref pin is the a/d converter module a/d0 and a/d1 reference voltage pin. to maintain chip reliability, ensure that av cc = 5 v ?.5 v and av ss = v ss during normal operation, and never leave the av cc and av ss pins open, even when the a/d converter is not being used. the voltage applied to the analog input pins should be in the range av ss ann av ref .
563 table 16.1 a/d converter pins pin name abbreviation i/o function analog power supply pin av cc input a/d0, a/d1 analog section power supply analog ground pin av ss input a/d0, a/d1 analog section ground and reference voltage analog reference power supply pin av ref input a/d0, a/d1 analog section reference voltage analog input pin 0 an0 input a/d0 analog inputs 0 to 3 (analog group 0) analog input pin 1 an1 input analog input pin 2 an2 input analog input pin 3 an3 input analog input pin 4 an4 input a/d0 analog inputs 4 to 7 (analog group 1) analog input pin 5 an5 input analog input pin 6 an6 input analog input pin 7 an7 input analog input pin 8 an8 input a/d0 analog inputs 8 to 11 (analog group 2) analog input pin 9 an9 input analog input pin 10 an10 input analog input pin 11 an11 input analog input pin 12 an12 input a/d1 analog inputs 12 to 15 (analog group 3) analog input pin 13 an13 input analog input pin 14 an14 input analog input pin 15 an15 input a/d conversion trigger input pin 0 adtrg0
564 16.1.4 register configuration table 16.2 summarizes the a/d converter? registers. table 16.2 a/d converter registers name abbreviation r/w initial value address access size * 1 a/d data register 0 (h/l) addr0 (h/l) r h'0000 h'fffff800 8, 16 a/d data register 1 (h/l) addr1 (h/l) r h'0000 h'fffff802 8, 16 a/d data register 2 (h/l) addr2 (h/l) r h'0000 h'fffff804 8, 16 a/d data register 3 (h/l) addr3 (h/l) r h'0000 h'fffff806 8, 16 a/d data register 4 (h/l) addr4 (h/l) r h'0000 h'fffff808 8, 16 a/d data register 5 (h/l) addr5 (h/l) r h'0000 h'fffff80a 8, 16 a/d data register 6 (h/l) addr6 (h/l) r h'0000 h'fffff80c 8, 16 a/d data register 7 (h/l) addr7 (h/l) r h'0000 h'fffff80e 8, 16 a/d data register 8 (h/l) addr8 (h/l) r h'0000 h'fffff810 8, 16 a/d data register 9 (h/l) addr9 (h/l) r h'0000 h'fffff812 8, 16 a/d data register 10 (h/l) addr10 (h/l) r h'0000 h'fffff814 8, 16 a/d data register 11 (h/l) addr11 (h/l) r h'0000 h'fffff816 8, 16 a/d data register 12 (h/l) addr12 (h/l) r h'0000 h'fffff820 8, 16 a/d data register 13 (h/l) addr13 (h/l) r h'0000 h'fffff822 8, 16 a/d data register 14 (h/l) addr14 (h/l) r h'0000 h'fffff824 8, 16 a/d data register 15 (h/l) addr15 (h/l) r h'0000 h'fffff826 8, 16 a/d control/status register 0 adcsr0 r/(w) * 2 h'00 h'fffff818 8, 16 a/d control register 0 adcr0 r/w h'0f h'fffff819 8, 16 a/d trigger register 0 adtrgr0 r/w h'ff h'fffff76e 8 a/d control/status register 1 adcsr1 r/(w) * 2 h'00 h'fffff838 8, 16 a/d control register 1 adcr1 r/w h'0f h'fffff839 8, 16 a/d trigger register 1 adtrgr1 r/w h'ff h'fffff72e 8 notes: register accesses consist of 6 or 7 cycles for byte access and 12 or 13 cycles for word access. 1. a 16-bit access must be made on a word boundary. 2. only 0 can be written to bit 7, to clear the flag.
565 16.2 register descriptions 16.2.1 a/d data registers 0 to 15 (addr0 to addr15) a/d data registers 0 to 15 (addr0 to addr15) are 16-bit read-only registers that store the results of a/d conversion. there are 31 registers, corresponding to analog inputs 0 to 15 (an0 to an15). the addr registers are initialized to h'0000 by a power-on reset, and in hardware standby mode and software standby mode. bit: 7 6 5 4 3 2 1 0 addrnh (upper byte) ad9 ad8 ad7 ad6 ad5 adr ad3 ad2 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 addrnl (lower byte) ad1 ad0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r (n = 0 to 15) the a/d converter converts analog input to a 10-bit digital value. the upper 8 bits of this data are stored in the upper byte of the addr corresponding to the selected channel, and the lower 2 bits in the lower byte of that addr. only the most significant 2 bits of the addr lower byte data are valid. table 16.3 shows correspondence between the analog input channels and a/d data registers.
566 table 16.3 analog input channels and a/d data registers analog input channel a/d data register analog input channel a/d data register an0 addr0 an8 addr8 an1 addr1 an9 addr9 an2 addr2 an10 addr10 an3 addr3 an11 addr11 an4 addr4 an12 addr12 an5 addr5 an13 addr13 an6 addr6 an14 addr14 an7 addr7 an15 addr15 16.2.2 a/d control/status register 0 (adcsr0) a/d control/status register 0 (adcsr0) is 8-bit readable/writable register whose function includes selection of the a/d conversion mode for a/d0. adcsr0 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. bit: 7 6 5 4 3 2 1 0 adf adie adm1 adm0 ch3 ch2 ch1 ch0 initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/w r/w r/w r/w r/w r/w r/w note: * only 0 can be written, to clear the flag. ? bit 7?/d end flag (adf): indicates the end of a/d conversion. bit 7: adf description 0 indicates that a/d0 is performing a/d conversion, or is in the idle state (initial value) [clearing conditions] ? ? ? ? ? ? ?
567 the operation of the a/d converter after adf is set to 1 differs between single mode and scan mode. in single mode, after the a/d converter transfers the digital value to addr, adf is set to 1 and the a/d converter enters the idle state. in scan mode (continuous scanning), after all the set conversions end adf is set to 1 and conversion is continued. for example, in the case of 12-channel scanning, adf is set to 1 immediately after the end of conversion for an8 to an11 (group 2). in scan mode (single-cycle scanning), after all the set analog conversions end adf is set to 1 and conversion is terminated. for example, in the case of 12-channel scanning, adf is set to 1 immediately after the end of conversion for an0 to an11. ? bit 6?/d interrupt enable (adie): enables or disables the a/d interrupt (adi). to prevent incorrect operation, ensure that the adst bit in a/d control registers 0 and 1 (adcr0) is cleared to 0 before switching the operating mode. bit 6: adie description 0 a/d interrupt (adi0) is disabled (initial value) 1 a/d interrupt (adi0) is enabled when a/d conversion ends and the adf bit is set to 1, an a/d0 or a/d1 a/d interrupt (adi0, adi1) will be generated if the adie bit is 1. adi0 and adi1 are cleared by clearing adf or adie to 0. ? bits 5 and 4: a/d mode 1 and 0 (adm1, adm0): these bits select the a/d conversion mode from single mode, 4-channel scan mode, 8-channel scan mode, and 12-channel scan mode. to prevent incorrect operation, ensure that the adst bit in a/d control registers 1 and 0 (adcr1, adcr0) is cleared to 0 before switching the operating mode. bit 5: adm1 bit 4: adm0 description 0 0 single mode (initial value) 1 4-channel scan mode (analog groups 0, 1, 2) 1 0 8-channel scan mode (analog groups 0, 1) 1 12-channel scan mode (analog groups 0, 1, 2) when adm1 and adm0 are set to 00, single mode is set. in single mode, operation ends after a/d conversion has been performed once on the analog channels selected with bits ch3 to ch0 in adcsr.
568 when adm1 and adm0 are set to 01, 4-channel scan mode is set. in scan mode, a/d conversion is performed continuously on a number of channels. the channels on which a/d conversion is to be performed in scan mode are set with bits ch3 to ch0 in adcsr0. in 4- channel scan mode, conversion is performed continuously on the channels in one of analog groups 0 (an0 to an3), 1 (an4 to an7), 2 (an8 to an11). when the adcs bit is cleared to 0, selecting scanning of all channels within the group (an0 to an3, an4 to an7, an8 to an11), conversion is performed continuously, once only for each channel within the group, and operation stops on completion of conversion for the last (highest-numbered) channel. when adm1 and adm0 are set to 10, 8-channel scan mode is set. in 8-channel scan mode, conversion is performed continuously on the 8 channels in analog groups 0 (an0 to an3) and 1 (an4 to an7). when the adcs bit is cleared to 0, selecting scanning of all channels within the groups (an0 to an7), conversion is performed continuously, once only for each channel within the groups, and operation stops on completion of conversion for the last (highest- numbered) channel. when adm1 and adm0 are set to 11, 12-channel scan mode is set. in 12-channel scan mode, conversion is performed continuously on the 12 channels in analog groups 0 (an0 to an3), 1 (an4 to an7), and 2 (an8 to an11). when the adcs bit is cleared to 0, selecting scanning of all channels within the groups (an0 to an11), conversion is performed continuously, once only for each channel within the groups, and operation stops on completion of conversion for the last (highest-numbered) channel. for details of the operation in single mode and scan mode, see section 16.4, operation. ? bits 3 to 0?hannel select 3 to 0 (ch3 to ch0): these bits, together with the adm1 and adm0 bits, select the analog input channels. to prevent incorrect operation, ensure that the adst bit in a/d control registers 1 and 0 (adcr1, adcr0) is cleared to 0 before changing the analog input channel selection.
569 analog input channels bit 3: bit 2: bit 1: bit 0: single mode 4-channel scan mode ch3 ch2 ch1 ch0 a/d0 a/d0 0000an0 (initial value) an0 1 an1 an0, an1 1 0 an2 an0 to an2 1 an3 an0 to an3 1 0 0 an4 an4 1 an5 an4, an5 1 0 an6 an4 to an6 1 an7 an4 to an7 1 0* 0 0 an8 an8 1 an9 an8, an9 1 0 an10 an8 to an10 1 an11 an8 to an11 note: * must be cleared to 0. analog input channels bit 3: bit 2: bit 1: bit 0: 8-channel scan mode 12-channel scan mode ch3 ch2 ch1 ch0 a/d0 a/d0 0000 an0, an4 an0, an4, an8 1 an0, an1, an4, an5 an0, an1, an4, an5, an8, an9 1 0 an0 to an2, an4 to an6 an0 to an2, an4 to an6, an8 to an10 1 an0 to an7 an0 to an11 1 0 0 an0, an4 an0, an4, an8 1 an0, an1, an4, an5 an0, an1, an4, an5, an8, an9 1 0 an0 to an2, an4 to an6 an0 to an2, an4 to an6, an8 to an10 1 an0 to an7 an0 to an11 10* 1 0 0 reserved* 2 an0, an4, an8 1 an0, an1, an4, an5, an8, an9 1 0 an0 to an2, an4 to an6, an8 to an10 1 an0 to an11 notes: 1. must be cleared to 0. 2. these modes are provided for future expansion, and cannot be used at present.
570 16.2.3 a/d control registers 0 and 1 (adcr0, adcr1) a/d control registers 0 and 1 (adcr0 and adcr1) are 8-bit readable/writable registers that control the start of a/d conversion and selects the operating clock for a/d0 and a/d1. adcr0 and adcr1 are initialized to h'0f by a power-on reset, and in hardware standby mode and software standby mode. bits 3 to 0 of adcr0 and adcr1 are reserved. these bits cannot be written to, and always return 1 if read. bit: 7 6 5 4 3 2 1 0 trge cks adst adcs initial value: 0 0 0 0 1 1 1 1 r/w: r/w r/w r/w r/w r r r r ? bit 7?rigger enable (trge): enables or disables triggering of a/d conversion by external input or the atu-ii. bit 7: trge description 0 a/d conversion triggering by external input or atu-ii is disabled (initial value) 1 a/d conversion triggering by external input or atu-ii is enabled for details of external or atu-ii trigger selection, see section 16.2.5, a/d trigger register 0 and 1. when atu triggering is selected, clear bit 7 of registers adtrgr0 and adtrgr1 to 0. when external triggering is selected, upon input of a low level to the adtrg0 pin after trge has been set to 1, the a/d converter detects the low level, and sets the adst bit to 1 in adcr. the same operation is subsequently performed when 1 is written in the adst bit by software. external triggering of a/d conversion is only enabled when the adst bit is cleared to 0. when external triggering is used, the low level input to the adtrg0 pin must be at least 1.5 p clock cycles in width. for details, see section 16.4.4, external triggering of a/d converter.
571 ? bit 6?lock select (cks): selects the a/d conversion time. a/d conversion is executed in a maximum of 532 states when cks is 0, and a maximum of 268 states when 1. to prevent incorrect operation, ensure that the adst bit a/d control registers 0 and 1 (adcr0 and adcr1) is cleared to 0 before changing the a/d conversion time. for details, see section 16.4.3, analog input sampling and a/d conversion time. bit 6: cks description 0 conversion time = 532 states (maximum) (initial value) 1 conversion time = 268 states (maximum) ? bit 5?/d start (adst): starts or stops a/d conversion. a/d conversion is started when adst is set to 1, and stopped when adst is cleared to 0. bit 5: adst description 0 a/d conversion is stopped (initial value) 1 a/d conversion is being executed [clearing conditions] ? ? note that the operation of the adst bit differs between single mode and scan mode. in single mode, adst is automatically cleared to 0 when a/d conversion ends on one channel. in scan mode (continuous scan), when all conversions have ended for the selected analog inputs, adst remains set to 1 in order to start a/d conversion again for all the channels. therefore, in scan mode (continuous scan), the adst bit must be cleared to 0, stopping a/d conversion, before changing the conversion time or the analog input channel selection. however, in scan mode (single-cycle scan), the adst bit is automatically cleared to 0, stopping a/d conversion, when one round of conversion ends on all the set channels. ensure that the adst bit in adcr0 and adcr1 is cleared to 0 before switching the operating mode. also, make sure that a/d conversion is stopped (adst is cleared to 0) before changing a/d interrupt enabling (bit adie in adcsr0 and adcsr1), the a/d conversion time (bit cks in adcr0 and adcr1), the operating mode (bits adm1 and adm0 in adscr0 and adcsr1), or the analog input channel selection (bits ch3 to ch0 in adcsr0 and adcsr1). the a/d data register contents will not be guaranteed if these changes are made while the a/d converter is operating (adst is set to 1).
572 ? bit 4?/d continuous scan (adcs): selects either single-cycle scan or continuous scan in scan mode. this bit is valid only when scan mode is selected. see section 16.4.2, scan mode, for details. bit 4: adcs description 0 single-cycle scan (initial value) 1 continuous scan ? bits 3 to 0?eserved: these bits are always read as 1, and should only be written with 1. 16.2.4 a/d control/status register 1 (adcsr1) a/d control/status register 1 (adcsr1) is an 8-bit readable/writable register whose functions include selection of the a/d conversion mode for a/d1. adcsr1 is initialized to h'00 by a power-on reset, and in hardware standby mode and software standby mode. bit: 7 6 5 4 3 2 1 0 adf adie adm1 adm0 ch3 ch2 ch1 ch0 initial value: 0 0 0 0 0 0 0 0 r/w: r/(w) * r/w r/w r/w r/w r/w r/w r/w note: * only 0 can be written, to clear the flag. ? bit 7?/d end flag (adf): indicates the end of a/d conversion. bit 7: adf description 0 indicates that a/d1 is performing a/d conversion, or is in the idle state (initial value) [clearing conditions] ? ? ? ? ? ? ? the operation of the a/d converter after adf is set to 1 differs between single mode and scan mode.
573 in single mode, after the a/d converter transfers the digital value to addr, adf is set to 1 and the a/d converter enters the idle state. in scan mode (continuous scanning), after all the set conversions end adf is set to 1 and conversion is continued. for example, in the case of 4- channel scanning, adf is set to 1 immediately after the end of conversion for an12 to an15 (group 3). in scan mode (single-cycle scanning), after all the set analog conversions end adf is set to 1 and conversion is terminated. for example, in the case of 4-channel scanning, adf is set to 1 immediately after the end of conversion for an12 to an15. ? bit 6?/d interrupt enable (adie): enables or disables the a/d interrupt (adi). to prevent incorrect operation, ensure that the adst bit in a/d control register 2 (adcr2) is cleared to 0 before switching the operating mode. bit 6: adie description 0 a/d interrupt (adi1) is disabled (initial value) 1 a/d interrupt (adi1) is enabled when a/d conversion ends and the adf bit in adcsr2 is set to 1, an a/d1 a/d interrupt (adi1) will be generated if the adie bit is 1. adi1 is cleared by clearing adf or adie to 0. ? bits 5 and 4: a/d mode 1 and 0 (adm1, adm0): these bits select the a/d conversion mode from single mode, 4-channel scan mode, 8-channel scan mode, 12-channel scan mode. to prevent incorrect operation, ensure that the adst bit in a/d control register 1, 0 (adcr1, 0) is cleared to 0 before switching the operating mode. bit 5: adm1 bit 4: adm0 description 0 0 single mode (initial value) 1 4-channel scan mode (analog groups 3) 1 0 reserved 1 reserved when adm1 and adm0 are set to 00, single mode is set. in single mode, operation ends after a/d conversion has been performed once on the analog channels selected with bits ch3 to ch0 in adcsr. when adm1 and adm0 are set to 01, 4-channel scan mode is set. in scan mode, a/d conversion is performed continuously on a number of channels. the channels on which a/d conversion is to be performed in scan mode are set with bits ch3 to ch0 in adcsr1. in 4- channel scan mode, conversion is performed continuously on the channels in one of analog groups 3 (an12 to an15).
574 when the adcs bit is cleared to 0, selecting scanning of all channels within the group (an12 to an15), conversion is performed continuously, once only for each channel within the group, and operation stops on completion of conversion for the last (highest-numbered) channel. for details of the operation in single mode and scan mode, see section 16.4, operation. ? bits 3 to 0?hannel select 3 to 0 (ch3 to ch0): these bits, together with the adm1 and adm0 bits, select the analog input channels. to prevent incorrect operation, ensure that the adst bit in a/d control register 1 (adcr1) is cleared to 0 before changing the analog input channel selection. analog input channels bit: bit: bit: bit: single mode 4-channel scan mode ch3 ch2 ch1 ch0 a/d1 a/d1 0* 1 0* 1 0 0 an12 (initial value) an12 1 an13 an12, an13 1 0 an14 an12 to an14 1 an15 an12 to an15 notes 1. these bits must be set to 0. 2. other modes, which are not described in this table are, for future use. be sure not to use the modes.
575 16.2.5 a/d trigger registers 0 and 1 (adtrgr0, adtrgr1) the a/d trigger registers (adtrgr0 and adtrgr1) are 8-bit readable/writable registers that select the a/d0 and a/d1 triggers. either external pin ( adtrg0 ) or atu-ii (atu-ii interval timer a/d conversion request) triggering can be selected. adtrg0 and adtrg1 are initialized to h'ff by a power-on reset and in hardware standby mode. they are not initialized in software standby mode. bit: 7 6 5 4 3 2 1 0 extrg initial value: 1 1 1 1 1 1 1 1 r/w: r/w r r r r r r r ? bit 7?rigger enable (extrg): selects external pin input ( adtrg0 ) or the atu-ii interval timer a/d conversion request. bit 7: extrg description 0 a/d conversion is triggered by the atu-ii channel 0 interval timer a/d conversion request 1 a/d conversion is triggered by external pin input ( adtrg in order to select external triggering or atu-ii triggering, the tgre bit in adcr0 and adcr1 must be set to 1. for details, see section 16.2.3, a/d control registers 0 and 1. ? bits 6 to 0?eserved: these bits are always read as 1, and should only be written with 1.
576 16.3 cpu interface a/d data registers 0 to 15 (addr0 to addr15) are 16-bit registers, but they are connected to the cpu by an 8-bit data bus. therefore, the upper and lower bytes must be read separately. to prevent the data being changed between the reads of the upper and lower bytes of an a/d data register, the lower byte is read via a temporary register (temp). the upper byte can be read directly. data is read from an a/d data register as follows. when the upper byte is read, the upper-byte value is transferred directly to the cpu and the lower-byte value is transferred into temp. next, when the lower byte is read, the temp contents are transferred to the cpu. when performing byte-size reads on an a/d data register, always read the upper byte before the lower byte. it is possible to read only the upper byte, but if only the lower byte is read, incorrect data may be obtained. if a word-size read is performed on an a/d data register, reading is performed in upper byte, lower byte order automatically. figure 16.2 shows the data flow for access to an a/d data register. cpu (h'aa) temp (h'40) addrnl (h'40) addrnh (h'aa) module data bus upper-byte read cpu (h'40) temp (h'40) addrnl (h'40) addrnh (h'aa) bus interface module data bus lower-byte read bus interface figure 16.2 a/d data register access operation (reading h'aa40)
577 16.4 operation the a/d converter operates by successive approximations with 10-bit resolution. it has two operating modes: single mode and scan mode. there are two kinds of scan mode: continuous and single-cycle. in single mode, conversion is performed once on one specified channel, then ends. in continuous scan mode, a/d conversion continues on one or more specified channels until the adst bit is cleared to 0. in single-cycle scan mode, a/d conversion ends after being performed once on one or more channels. 16.4.1 single mode single mode, should be selected when only one a/d conversion on one channel is required. single mode is selected by setting the adm1 and adm0 bits in the a/d control/status register (adscr) to 00. when the adst bit in the a/d control register (adcr) is set to 1, a/d conversion is started in single mode. the adst bit remains set to 1 during a/d conversion, and is automatically cleared to 0 when conversion ends. when conversion ends, the adf flag in adcsr is set to 1. if the adie bit in adcsr is also 1, an adi interrupt is requested. to clear the adf flag, first read adf when set to 1, then write 0 to adf. if the dmac is activated by the adi interrupt, adf is cleared automatically. an example of the operation when analog input channel 1 (an1) is selected and a/d conversion is performed in single mode is described next. figure 16.3 shows a timing diagram for this example. 1. single mode is selected (adm1 = adm0 = 0), input channel an1 is selected (ch3 = ch2 = ch1 = 0, ch0 = 1), the a/d interrupt is enabled (adie = 1), and a/d conversion is started (adst = 1). 2. when a/d conversion is completed, the result is transferred to addr1. at the same time the adf flag is set to 1, the adst bit is cleared to 0, and the a/d converter becomes idle. 3. since adf = 1 and adie = 1, an adi interrupt is requested. 4. the a/d interrupt handling routine is started. 5. the routine reads adf set to 1, then writes 0 to adf. 6. the routine reads and processes the conversion result (addr1). 7. execution of the a/d interrupt handling routine ends. after this, if the adst bit is set to 1, a/d conversion starts again and steps 2 to 7 are repeated.
578 idle set * set * a/d conver- sion starts set * clear * clear * idle idle idle a/d con- version (1) idle idle read conversion result read conversion result a/d conversion result (1) a/d conversion result (2) state of channel 0 (an0) adf adst adie state of channel 1 (an1) state of channel 2 (an2) state of channel 3 (an3) addr0 addr1 addr2 addr3 note: * vertical arrows ( figure 16.3 example of a/d converter operation (single mode, channel 1 selected)
579 16.4.2 scan mode scan mode is useful for monitoring analog inputs in a group of one or more channels. scan mode is selected for a/d0 by setting the adm1 and adm0 bits in a/d control/status register 0 or 1 (adscr0) to 01 (4-channel scan mode), or 11 (12-channel scan mode). for a/d1, scan mode is selected by setting the adm1 and adm0 bits in a/d control/status register 1 (adcsr1) to 01 (4-channel scan mode). when the adcs bit is cleared to 0 and the adst bit is set to 1 in the a/d control register (adcr), single-cycle scanning is performed. when the adcs bit is set to 1 and the adst bit is set to 1, continuous scanning is performed. in scan mode, a/d conversion is performed in low-to-high analog input channel number order (an0, an1 ... an11, an12, an13 ... an15). in single-cycle scanning, the adf bit in adcsr is set to 1 when conversion has been performed once on all the set channels, and the adst bit is automatically cleared to 0. in continuous scanning, the adf bit in adcsr is set to 1 when conversion ends on all the set channels. to stop a/d conversion, write 0 to the adst bit. if the adie bit in adcsr is set to 1 when adf is set to 1, an adi interrupt (adi0, adi1, or adi2) is requested. to clear the adf flag, first read adf when set to 1, then write 0 to adf. if the dmac is activated by the adi interrupt, adf is cleared to 0 automatically. an example of the operation when analog inputs 0 to 11 (an0 to an11) are selected and a/d conversion is performed in single-cycle scan mode is described below. figure 16.4 shows the operation timing for this example. 1. 12-channel scan mode is selected (adm1 = 1, adm0 = 1), single-cycle scan mode is selected (adcs = 0), analog input channels an0 to an11 are selected (ch3 = 0, ch2 = 0, ch1 = 1, ch0 = 1), and a/d conversion is started. 2. when conversion of the first channel (an0) is completed, the result is transferred to addr0. next, conversion of the second channel (an1) starts automatically. 3. conversion proceeds in the same way through the 12th channel (an11). 4. when conversion is completed for all the selected channels (an0 to an11), the adf flag is set to 1, the adst bit is cleared to 0 automatically, and a/d conversion stops. if the adie bit is 1, an adi interrupt is requested after a/d conversion ends.
580 an example of the operation when analog inputs 0 to 2 and 4 to 6 (an0 to an2 and an4 to an6) are selected and a/d conversion is performed in 8-channel scan mode is described below. figure 16.5 shows the operation timing. 1. 8-channel scan mode is selected (adm1 = 1, adm0 = 0) continuous scan mode is selected (adcs = 1), analog input channels an0 to an2 and an4 to an6 are selected (ch3 = 0, ch2 = 0, ch1 = 1, ch0 = 0), and a/d conversion is started. 2. when conversion of the first channel (an0) is completed, the result is transferred to addr0. next, conversion of the second channel (an1) starts automatically. 3. conversion proceeds in the same way through the third channel (an2). 4. conversion of the fourth channel (an4) starts automatically. 5. conversion proceeds in the same way through the sixth channel (an6) 6. when conversion is completed for all the selected channels (an0 to an2 and an4 to an6), the adf flag is set to 1. if the adie bit is also 1, an adi interrupt is requested. 7. steps 2 to 6 are repeated as long as the adst bit remains set to 1. when the adst bit is cleared to 0, a/d conversion stops. after this, if the adst bit is set to 1, a/d conversion starts again from the first channel (an0).
581 adst adf addr0 addo1 addr2 addr9 addr10 addr11 state of channel 0 (an0) state of channel 1 (an1) state of channel 2 (an2) state of channel 9 (an9) state of channel 10 (an10) state of channel 11 (an11) idle idle continuous a/d conversion set * clear * clear * idle idle idle idle a/d conver- sion (1) a/d conver- sion (2) a/d conver- sion (3) a/d conver- sion (9) a/d conver- sion (10) a/d conver- sion (11) idle idle idle idle idle idle a/d conversion result (0) a/d conversion result (1) a/d conversion result (2) a/d conversion result (9) a/d conversion result (10) a/d conversion result (11) note: * vertical arrows ( ) indicate instructions executed by software. figure 16.4 example of a/d converter operation (scan mode (single-cycle scan), channels an0 to an11 selected)
582 continuous a/d conversion set * 1 adst adf addr0 addr1 addr2 addr3 addr4 addr5 addr6 addr7 clear * 1 clear * 1 * 2 state of channel 0 (an0) state of channel 1 (an1) state of channel 2 (an2) state of channel 3 (an3) state of channel 4 (an4) state of channel 5 (an5) state of channel 6 (an6) state of channel 7 (an7) idle idle idle idle idle idle idle idle idle idle idle idle idle idle idle idle idle a/d conversion result (10) a/d conversion result (6) notes: 1. vertical arrows ( ) indicate instructions executed by software. 2. data currently being converted is ignored. a/d conversion result (5) a/d conver- sion (1) a/d conver- sion (2) a/d conver- sion (3) a/d conver- sion (7) a/d conver- sion (8) a/d conver- sion (9) idle a/d conver- sion (10) a/d conver- sion (11) idle a/d conver- sion (5) a/d conver- sion (6) a/d conver- sion (4) a/d conversion result (7) a/d conversion result (8) a/d conversion result (9) a/d conversion result (3) a/d conversion result (2) a/d conversion result (1) a/d conversion result (4) figure 16.5 example of a/d converter operation (scan mode (continuous scan), channels an0 to an2 and an4 to an6 selected)
583 16.4.3 analog input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit in a/d0, a/d1, and a/d2. the a/d converter samples the analog input at time t d (a/d conversion start delay time) after the adst bit is set to 1, then starts conversion. figure 16.6 shows the a/d conversion timing. the a/d conversion time (t conv ) includes t d and the analog input sampling time (t spl ). the length of t d is not fixed, since it includes the time required for synchronization of the a/d conversion operation. the total conversion time therefore varies within the ranges shown in table 16.4. in scan mode, the t conv values given in table 16.4 apply to the first conversion. in the second and subsequent conversions, t conv is fixed at 512 states when cks = 0 or 256 states when cks = 1. table 16.4 a/d conversion time (single mode) cks = 0 cks = 1 item symbol min typ max min typ max unit a/d conversion start delay time t d 20 ? 34 12 ? 18 states (
584 a/d conversion sample-and-hold idle end of a/d conversion a/d conversion time (t conv ) analog input sampling time (t spl ) a/d conversion start delay time (t d ) write cycle a/d synchronization time (6 states) (up to 28 states) adst write timing p figure 16.6 a/d conversion timing
585 16.4.4 external triggering of a/d converter a/d conversion can be externally triggered. to activate the a/d converter with an external trigger, first set the pin functions with the pfc (pin function controller) and input a high level to the adtrg pin, then set the trge bit to 1 and clear the adst bit to 0 in the a/d control register (adcr), and set the extrg bit to 1 in the a/d trigger register (adtrgr). when a low level is input to the adtrg pin after these settings have been made, the a/d converter detects the low level and sets the adst bit to 1. if a low level is being input to the adtrg pin when a/d conversion ends, the adst bit is set to 1 again, and a/d conversion is started. figure 16.7 shows the timing for external trigger input. the adst bit is set to 1 two states after the a/d converter samples the low level on the adtrg pin. the timing from setting of the adst bit until the start of a/d conversion is the same as when 1 is written into the adst bit by software. adtrg adtrg figure 16.7 external trigger input timing
586 16.4.5 a/d converter activation by atu-ii the a/d0 and a/d1 converter modules can be activated by an a/d conversion request from the atu-ii s channel 0 interval timer. to activate the a/d converter by means of the atu-ii, set the trge bit to 1 in the a/d control register (adcr) and clear the extrg bit to 0 in the a/d trigger register (adtrgr). when an atu-ii channel 0 interval timer a/d conversion request is generated after these settings have been made, the adst bit set to 1. the timing from setting of the adst bit until the start of a/d conversion is the same as when 1 is written into the adst bit by software. 16.5 interrupt sources and dma transfer requests the a/d converter can generate an a/d conversion end interrupt request (adi0 or adi1) upon completion of a/d conversions. the adi interrupt can be enabled by setting the adie bit in the a/d control/status register (adcsr) to 1, or disabled by clearing the adie bit to 0. the dmac can be activated by an adi interrupt. in this case an interrupt request is not sent to the cpu. when the dmac is activated by an adi interrupt, the adf bit in adcsr is automatically cleared when data is transferred by the dmac. see section 9.4.2, example of dma transfer between a/d converter and on-chip memory, for an example of this operation. 16.6 usage notes the following points should be noted when using the a/d converter. 1. analog input voltage range the voltage applied to analog input pins during a/d conversion should be in the range av ss an n av ref . 2. relation between av ss , av cc and v ss , v cc when using the a/d converter, set av cc = 5.0 v 0.5 v, and av ss = v ss . when the a/d converter is not used, set av ss = v ss , and do not leave the av cc pin open. 3. av ref input range set av ref = 4.5 v to av cc when the a/d converter is used, and av ref av cc when not used. if conditions above are not met, the reliability of the device may be adversely affected.
587 4. notes on board design in board design, digital circuitry and analog circuitry should be as mutually isolated as possible, and layout in which digital circuit signal lines and analog circuit signal lines cross or are in close proximity should be avoided as far as possible. failure to do so may result in incorrect operation of the analog circuitry due to inductance, adversely affecting a/d conversion values. also, digital circuitry must be isolated from the analog input signals (ann), analog reference voltage (av ref ), and analog power supply (av cc ) by the analog ground (av ss ). av ss should be connected at one point to a stable digital ground (v ss ) on the board. 5. notes on noise countermeasures a protection circuit connected to prevent damage due to an abnormal voltage such as an excessive surge at the analog input pins (ann) and analog reference voltage (av ref ) should be connected between av cc and av ss as shown in figure 16.8. also, the bypass capacitors connected to av cc and av ref and the filter capacitor connected to ann must be connected to av ss . if a filter capacitor is connected as shown in figure 16.8, the input currents at the analog input pins (ann) are averaged, and so an error may arise. careful consideration is therefore required when deciding the circuit constants. av cc av ref an0 e an31 av ss sh7052 sh7053 sh7054 notes: 10 * 2 * 1 * 1 0.1 ? figure 16.8 example of analog input pin protection circuit
588 table 16.5 analog pin specifications item min max unit analog input capacitance ? 20 pf permissible signal source impedance ? 3k ? 16.6.1 a/d conversion accuracy definitions a/d conversion accuracy definitions are given below. 1. resolution the number of a/d converter digital conversion output codes 2. offset error the deviation of the analog input voltage value from the ideal a/d conversion characteristic when the digital output changes from the minimum voltage value 0000000000 to 0000000001 (does not include quantization error) (see figure 16.9). 3. full-scale error the deviation of the analog input voltage value from the ideal a/d conversion characteristic when the digital output changes from 1111111110 to 111111111 (does not include quantization error) (see figure 16.9). 4. quantization error the deviation inherent in the a/d converter, given by 1/2 lsb (see figure 16.9). 5. nonlinearity error the error with respect to the ideal a/d conversion characteristic between the zero voltage and the full-scale voltage. does not include the offset error, full-scale error, or quantization error. 6. absolute accuracy the deviation between the digital value and the analog input value. includes the offset error, full-scale error, quantization error, and nonlinearity error.
589 digital output 111 110 101 100 011 010 001 000 1/8 2/8 3/8 4/8 5/8 6/8 7/8 fs 0 analog input voltage quantization error ideal a/d conversion characteristic digital output fs analog input voltage offset error ideal a/d conversion characteristic actual a/d conversion characteristic full-scale error nonlinearity error figure 16.9 a/d conversion accuracy definitions
590
591 section 17 advanced user debugger (aud) 17.1 overview the sh7052f/sh7053f/sh7054f has an on-chip advanced user debugger (aud). use of the aud simplifies the construction of a simple emulator, with functions such as acquisition of branch trace data and monitoring/tuning of on-chip ram data. 17.1.1 features the aud has the following features: ? eight input/output pins ? data bus (audata3 to audata0) ? aud reset ( audrst ) ? aud sync signal ( audsync ) ? aud clock (audck) ? aud mode (audmd) ? two modes branch trace mode or ram monitor mode can be selected by switching audmd. ? branch trace mode when the pc branches on execution of a branch instruction or generation of an interrupt in the user program , the branch is detected by the aud and the branch destination address is output from audata. the address is compared with the previously output address, and 4-, 8-, 16-, or 32-bit output is selected automatically according to the upper address matching status. ? ram monitor mode when an address is written to audata from off-chip, the data corresponding to that address is output. if an address and data are written to audata, the data is transferred to that address.
592 17.1.2 block diagram figure 17.1 shows a block diagram of the aud. pc output circuit address buffer data buffer mode control internal bus bus controller peripheral module bus on-chip memory on-chip peripheral module cpu audata0 audata1 audata2 audata3 audrst audsync figure 17.1 aud block diagram 17.2 pin configuration table 17.1 shows the aud? input/output pins. table 17.1 aud pins function name abbreviation branch trace mode ram monitor mode aud data audata3 to audata0 branch destination address output monitor address/data input/output aud reset audrst audsync
593 17.2.1 pin descriptions pins used in both modes pin description audmd the mode is selected by changing the input level at this pin. low: branch trace mode high: ram monitor mode the input at this pin should be changed when audrst audrst audrst
594 pin functions in branch trace mode pin description audck this pin outputs 1/2 the operating frequency ( audsync audsync audsync audsync
595 pin functions in ram monitor mode pin description audck the external clock input pin. input the clock to be used for debugging to this pin. the input frequency must not exceed 1/4 the operating frequency. when no connection is made, this pin is pulled up internally. audsync audsync 17.3 branch trace mode 17.3.1 overview in this mode, the branch destination address is output when a branch occurs in the user program. branches may be caused by branch instruction execution or interrupt/exception processing, but no distinction is made between the two in this mode. 17.3.2 operation operation starts in branch trace mode when audrst is asserted, audmd is driven low, then audrst is negated. figure 17.2 shows an example of data output. while the user program is being executed without branches, the audata pins constantly output 0011 in synchronization with audck. when a branch occurs, after execution starts at the branch destination address in the pc, the previous fully output address (i.e. for which output was not interrupted by the occurrence of another branch) is compared with the current branch address, and depending on the result, audsync is asserted and the branch destination address output after 1-clock output of 1000 (in the case of 4-bit output), 1001 (8-bit output), 1010 (16-bit output), or 1011 (32-bit output). the initial value of the compared address is h'00000000. on completion of the cycle in which the address is output, audsync is negated and 0011 is output from the audata pins.
596 if another branch occurs during branch destination address output, the later branch has priority for output. in this case, audsync is negated and the audata pins output the address after outputting 10xx again (figure 17.3 shows an example of the output when consecutive branches occur). note that the compared address is the previous fully output address, and not an interrupted address (since the upper address of an interrupted address will be unknown). the interval from the start of execution at the branch destination address in the pc until the audata pins output 10xx is 1.5 or 2 audck cycles. audck 0011 0011 1011 a3 e a0 a7 e a4 a11 e a8 a15 e a12 a19 e a16 a23 e a20 a27 e a24 a31 e a28 0011 audsync audata [3:0] start of execution at branch destination address in pc figure 17.2 example of data output (32-bit output) audck 0011 0011 1011 a3 e a0 0011 0011 a3 e a0 a7 e a4 1010 a7 e a4 a11 e a8 a15 e a12 audsync audata [3:0] start of execution at branch destination address in pc (1) start of execution at branch destination address in pc (2) figure 17.3 example of output in case of successive branches
597 17.4 ram monitor mode 17.4.1 overview in this mode, all the modules connected to the sh7052f/sh7053f/sh7054f? internal or external bus can be read and written to, allowing ram monitoring and tuning to be carried out. 17.4.2 communication protocol the aud latches the audata input when audsync is asserted. the following audata input format should be used. 0000 dir a3 to a0 a31 to a28 d3 to d0 dn to dn-3 input format spare bits (4 bits): b'0000 command fixed at 1 0: read 1: write 00: byte 01: word 10: longword bit 3 bit 2 bit 1 bit 0 . . . . . . . . . . . . address data (in case of write only) b write: n = 7 w write: n = 15 l write: n = 31 figure 17.4 audata input format
598 17.4.3 operation operation starts in ram monitor mode audmd is driven high after audrst has been asserted, then audrst is negated. figure 17.5 shows an example of a read operation, and figure 17.6 an example of a write operation. when audsync is asserted, input from the audata pins begins. when a command, address, or data (writing only) is input in the format shown in figure 17.4 audata input format, execution of read/write access to the specified address is started. during internal execution, the aud returns not ready (0000). when execution is completed, the ready flag (0001) is returned (figures 17.5 and 17.6). in a read, data of the specified size is output when audsync is negated following detection of this flag (figure 17.5). if a command other than the above is input in dir, the aud treats this as a command error, disables processing, and sets bit 1 in the ready flag to 1. if a read/write operation initiated by the command specified in dir causes a bus error, the aud disables processing and sets bit 2 in the ready flag to 1 (figure 17.7). table 17.2 ready flag format bit 3 bit 2 bit 1 bit 0 fixed at 0 0: normal status 1: bus error 0: normal status 1: bus error 0: not ready 1: ready bus error conditions 1. word access to address 4n+1 or 4n+3 2. longword access to address 4n+1, 4n+2, or 4n+3 3. longword access to on-chip i/o 8-bit space 4. access to external space in single-chip mode audck not ready dir ready ready ready 0001 0001 0000 0000 1000 0001 a31 e a28 d7 e d4 d3 e d0 a3 e a0 audsync audatan input/output switchover input output figure 17.5 example of read operation (byte read)
599 audck not ready ready dir ready ready 0000 0000 1110 0001 0001 0001 a31 e a28 d3 e d0 d31 e d28 a3 e a0 audsync audatan input/output switchover input output figure 17.6 example of write operation (longword read) audck not ready dir ready (bus error) ready (bus error) ready (bus error) 0101 0101 0000 0000 1010 0101 a31 e a28 a3 e a0 audsync audatan input/output switchover input output figure 17.7 example of error occurrence (longword read) 17.5 usage notes 17.5.1 initialization the debugger? internal buffers and processing states are initialized in the following cases: 1. in a power-on reset 2. in hardware standby mode 3. when audrst is driven low 4. when the audsrst bit is set to 1 in the syscr register (see section 23.2.2) 5. when the mstop3 bit is set to 1 in the mstcr register (see section 23.2.3) 17.5.2 operation in software standby mode the debugger is not initialized in software standby mode. however, since the sh7052f/sh7053f/sh7054f? internal operation halts in software standby mode: 1. when audmd is high (ram monitor mode): ready is not returned (not ready continues to be returned) however, when operating on an external clock, the protocol continues. 2. when audmd is low (pc trace): operation stops. however, operation continues when stby is released.
600 17.5.3 rom area writes do not perform an aud write to a rom address immediately after an atu register write cycle. for details, see ?riting to rom area immediately after atu register write?in section 10.7, usage notes.
601 section 18 pin function controller (pfc) 18.1 overview the pin function controller (pfc) consists of registers for selecting multiplex pin functions and their input/output direction. table 18.1 shows the sh7052f/sh7053f/sh7054f? multiplex pins. table 18.1 sh7052f/sh7053f/sh7054f multiplex pins port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) a pa0 input/output (port) ti0a input (atu) a pa1 input/output (port) ti0b input (atu) a pa2 input/output (port) ti0c input (atu) a pa3 input/output (port) ti0d input (atu) a pa4 input/output (port) tio3a input/output (atu) a pa5 input/output (port) tio3b input/output (atu) a pa6 input/output (port) tio3c input/output (atu) a pa7 input/output (port) tio3d input/output (atu) a pa8 input/output (port) tio4a input/output (atu) a pa9 input/output (port) tio4b input/output (atu) a pa10 input/output (port) tio4c input/output (atu) a pa11 input/output (port) tio4d input/output (atu) a pa12 input/output (port) tio5a input/output (atu) a pa13 input/output (port) tio5b input/output (atu) a pa14 input/output (port) txd0 output (sci) a pa15 input/output (port) rxd0 input (sci) b pb0 input/output (port) to6a output (atu) b pb1 input/output (port) to6b output (atu) b pb2 input/output (port) to6c output (atu) b pb3 input/output (port) to6d output (atu) b pb4 input/output (port) to7a output (atu) to8a output (atu) b pb5 input/output (port) to7b output (atu) to8b output (atu) b pb6 input/output (port) to7c output (atu) to8c output (atu) b pb7 input/output (port) to7d output (atu) to8d output (atu) b pb8 input/output (port) txd3 output (sci) to8e output (atu) b pb9 input/output (port) rxd3 input (sci) to8f output (atu)
602 table 18.1 sh7052f/sh7053f/sh7054f multiplex pins (cont) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) b pb10 input/output (port) txd4 output (sci) htxd output (hcan) to8g output (atu) b pb11 input/output (port) rxd4 input (sci) hrxd input (hcan) to8h output (atu) b pb12 input/output (port) tclka input (atu) ubctrg irq0
603 table 18.1 sh7052f/sh7053f/sh7054f multiplex pins (cont) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) e pe8 input/output (port) a8 output (bsc) e pe9 input/output (port) a9 output (bsc) e pe10 input/output (port) a10 output (bsc) e pe11 input/output (port) a11 output (bsc) e pe12 input/output (port) a12 output (bsc) e pe13 input/output (port) a13 output (bsc) e pe14 input/output (port) a14 output (bsc) e pe15 input/output (port) a15 output (bsc) f pf0 input/output (port) a16 output (bsc) f pf1 input/output (port) a17 output (bsc) f pf2 input/output (port) a18 output (bsc) f pf3 input/output (port) a19 output (bsc) f pf4 input/output (port) a20 output (bsc) f pf5 input/output (port) a21 output (bsc) pod wrl wrh wait rd cs0 cs1 cs2 cs3 back breq irq1 irq2 irq3 adtrg0
604 table 18.1 sh7052f/sh7053f/sh7054f multiplex pins (cont) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) h ph5 input/output (port) d5 input/output (bsc) h ph6 input/output (port) d6 input/output (bsc) h ph7 input/output (port) d7 input/output (bsc) h ph8 input/output (port) d8 input/output (bsc) h ph9 input/output (port) d9 input/output (bsc) h ph10 input/output (port) d10 input/output (bsc) h ph11 input/output (port) d11 input/output (bsc) h ph12 input/output (port) d12 input/output (bsc) h ph13 input/output (port) d13 input/output (bsc) h ph14 input/output (port) d14 input/output (bsc) h ph15 input/output (port) d15 input/output (bsc) j pj0 input/output (port) tio2a input/output (atu) j pj1 input/output (port) tio2b input/output (atu) j pj2 input/output (port) tio2c input/output (atu) j pj3 input/output (port) tio2d input/output (atu) j pj4 input/output (port) tio2e input/output (atu) j pj5 input/output (port) tio2f input/output (atu) j pj6 input/output (port) tio2g input/output (atu) j pj7 input/output (port) tio2h input/output (atu) j pj8 input/output (port) tio5c input/output (atu) j pj9 input/output (port) tio5d input/output (atu) j pj10 input/output (port) ti9a input (atu) j pj11 input/output (port) ti9b input (atu) j pj12 input/output (port) ti9c input (atu) j pj13 input/output (port) ti9d input (atu) j pj14 input/output (port) ti9e input (atu) j pj15 input/output (port) ti9f input (atu) k pk0 input/output (port) to8a output (atu) k pk1 input/output (port) to8b output (atu) k pk2 input/output (port) to8c output (atu) k pk3 input/output (port) to8d output (atu) k pk4 input/output (port) to8e output (atu) k pk5 input/output (port) to8f output (atu)
605 table 18.1 sh7052f/sh7053f/sh7054f multiplex pins (cont) port function 1 (related module) function 2 (related module) function 3 (related module) function 4 (related module) k pk6 input/output (port) to8g output (atu) k pk7 input/output (port) to8h output (atu) k pk8 input/output (port) to8i output (atu) k pk9 input/output (port) to8j output (atu) k pk10 input/output (port) to8k output (atu) k pk11 input/output (port) to8l output (atu) k pk12 input/output (port) to8m output (atu) k pk13 input/output (port) to8n output (atu) k pk14 input/output (port) to8o output (atu) k pk15 input/output (port) to8p output (atu)
606 18.2 register configuration pfc registers are listed in table 18.2. table 18.2 pfc registers name abbreviation r/w initial value address access size port a io register paior r/w h'0000 h'fffff720 8, 16 port a control register h pacrh r/w h'0000 h'fffff722 8, 16 port a control register l pacrl r/w h'0000 h'fffff724 8, 16 port b io register pbior r/w h'0000 h'fffff730 8, 16 port b control register h pbcrh r/w h'0000 h'fffff732 8, 16 port b control register l pbcrl r/w h'0000 h'fffff734 8, 16 port b invert register pbir r/w h'0000 h'fffff736 8, 16 port c io register pcior r/w h'0000 h'fffff73a 8, 16 port c control register pccr r/w h'0000 h'fffff73c 8, 16 port d io register pdior r/w h'0000 h'fffff740 8, 16 port d control register h pdcrh r/w h'0000 h'fffff742 8, 16 port d control register l pdcrl r/w h'0000 h'fffff744 8, 16 port e io register peior r/w h'0000 h'fffff750 8, 16 port e control register pecr r/w h'0000 h'fffff752 8, 16 port f io register pfior r/w h'0000 h'fffff748 8, 16 port f control register h pfcrh r/w h'0015 h'fffff74a 8, 16 port f control register l pfcrl r/w h'5000 h'fffff74c 8, 16 port g io register pgior r/w h'0000 h'fffff760 8, 16 port g control register pgcr r/w h'0000 h'fffff762 8, 16 port h io register phior r/w h'0000 h'fffff728 8, 16 port h control register phcr r/w h'0000 h'fffff72a 8, 16 port j io register pjior r/w h'0000 h'fffff766 8, 16 port j control register h pjcrh r/w h'0000 h'fffff768 8, 16 port j control register l pjcrl r/w h'0000 h'fffff76a 8, 16 port k io register pkior r/w h'0000 h'fffff770 8, 16 port k control register h pkcrh r/w h'0000 h'fffff772 8, 16 port k control register l pkcrl r/w h'0000 h'fffff774 8, 16 port k invert register pkir r/w h'0000 h'fffff776 8, 16
607 18.3 register descriptions 18.3.1 port a io register (paior) bit: 15 14 13 12 11 10 9 8 pa15 ior pa14 ior pa13 ior pa12 ior pa11 ior pa10 ior pa9 ior pa8 ior initial value: 00000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pa7 ior pa6 ior pa5 ior pa4 ior pa3 ior pa2 ior pa1 ior pa0 ior initial value: 00000000 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port a io register (paior) is a 16-bit readable/writable register that selects the input/output direction of the 16 pins in port a. bits pa15ior to pa0ior correspond to pins pa15/rxd0 to pa0/ti0a. paior is enabled when port a pins function as general input/output pins (pa15 to pa0) or atu input/output pins, and disabled otherwise. for bits 3 to 0, when atu input capture input is selected, the paior bits should be cleared to 0. when port a pins function as pa15 to pa0 or atu input/output pins, a pin becomes an output when the corresponding bit in paior is set to 1, and an input when the bit is cleared to 0. paior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. 18.3.2 port a control registers h and l (pacrh, pacrl) port a control registers h and l (pacrh, pacrl) are 16-bit readable/writable registers that select the functions of the 16 multiplex pins in port a. pacrh selects the functions of the pins for the upper 8 bits of port a, and pacrl selects the functions of the pins for the lower 8 bits. pacrh and pacrl are initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. they are not initialized in software standby mode or sleep mode.
608 port a control register h (pacrh) bit: 15 14 13 12 11 10 9 8 ? pa15md ? pa14md ? pa13md ? pa12md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pa11md ? pa10md ? pa9md ? pa8md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?a15 mode bit (pa15md): selects the function of pin pa15/rxd0. bit 14: pa15md description 0 general input/output (pa15) (initial value) 1 receive data input (rxd0) ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?a14 mode bit (pa14md): selects the function of pin pa14/txd0. bit 12: pa14md description 0 general input/output (pa14) (initial value) 1 transmit data output (txd0) ? bit 11?eserved: this bit always reads 0. the write value should always be 0. ? bit 10?a13 mode bit (pa13md): selects the function of pin pa13/tio5b. bit 10: pa13md description 0 general input/output (pa13) (initial value) 1 atu input capture input/output compare output (tio5b) ? bit 9?eserved: this bit always reads 0. the write value should always be 0.
609 ? bit 8?a12 mode bit (pa12md): selects the function of pin pa12/tio5a. bit 8: pa12md description 0 general input/output (pa12) (initial value) 1 atu input capture input/output compare output (tio5a) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?a11 mode bit (pa11md): selects the function of pin pa11/tio4d. bit 6: pa11md description 0 general input/output (pa11) (initial value) 1 atu input capture input/output compare output (tio4d) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?a10 mode bit (pa10md): selects the function of pin pa10/tio4c. bit 4: pa10md description 0 general input/output (pa10) (initial value) 1 atu input capture input/output compare output (tio4c) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?a9 mode bit (pa9md): selects the function of pin pa9/tio4b. bit 2: pa9md description 0 general input/output (pa9) (initial value) 1 atu input capture input/output compare output (tio4b) ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?a8 mode bit (pa8md): selects the function of pin pa8/tio4a. bit 0: pa8md description 0 general input/output (pa8) (initial value) 1 atu input capture input/output compare output (tio4a)
610 port a control register l (pacrl) bit: 15 14 13 12 11 10 9 8 ? pa7md ? pa6md ? pa5md ? pa4md initial value: 0 0 0 0 0 0 0 0 r/w: ? r/w ? r/w ? r/w ? r/w bit: 7 6 5 4 3 2 1 0 ? pa3md ? pa2md ? pa1md ? pa0md initial value: 0 0 0 0 0 0 0 0 r/w: ? r/w ? r/w ? r/w ? r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?a7 mode bit (pa7md): selects the function of pin pa7/tio3d. bit 14: pa7md description 0 general input/output (pa7) (initial value) 1 atu input capture input/output compare output (tio3d) ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?a6 mode bit (pa6md): selects the function of pin pa6/tio3c. bit 12: pa6md description 0 general input/output (pa6) (initial value) 1 atu input capture input/output compare output (tio3c) ? bit 11?eserved: this bit always reads 0. the write value should always be 0. ? bit 10?a5 mode bit (pa5md): selects the function of pin pa5/tio3b. bit 10: pa5md description 0 general input/output (pa5) (initial value) 1 atu input capture input/output compare output (tio3b) ? bit 9?eserved: this bit always reads 0. the write value should always be 0.
611 ? bit 8?a4 mode bit (pa4md): selects the function of pin pa4/tio3a. bit 8: pa4md description 0 general input/output (pa4) (initial value) 1 atu input capture input/output compare output (tio3a) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?a3 mode bit (pa3md): selects the function of pin pa3/ti0d. bit 6: pa3md description 0 general input/output (pa3) (initial value) 1 atu input capture input (ti0d) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?a2 mode bit (pa2md): selects the function of pin pa2/ti0c. bit 4: pa2md description 0 general input/output (pa2) (initial value) 1 atu input capture input (ti0c) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?a1 mode bit (pa1md): selects the function of pin pa1/ti0b. bit 2: pa1md description 0 general input/output (pa1) (initial value) 1 atu input capture input (ti0b) ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?a0 mode bit (pa0md): selects the function of pin pa0/ti0a. bit 0: pa1md description 0 general input/output (pa0) (initial value) 1 atu input capture input (ti0a)
612 18.3.3 port b io register (pbior) bit: 15 14 13 12 11 10 9 8 pb15 ior pb14 ior pb13 ior pb12 ior pb11 ior pb10 ior pb9 ior pb8 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pb7 ior pb6 ior pb5 ior pb4 ior pb3 ior pb2 ior pb1 ior pb0 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port b io register (pbior) is a 16-bit readable/writable register that selects the input/output direction of the 16 pins in port b. bits pb15ior to pb0ior correspond to pins pb15/puls5/sck2 to pb0/to6a. pbior is enabled when port b pins function as general input/output pins (pb15 to pb0) or serial clock pins (sck0, sck1, sck2), and disabled otherwise. when port b pins function as pb15 to pb0 or sck0, sck1, and sck2, a pin becomes an output when the corresponding bit in pbior is set to 1, and an input when the bit is cleared to 0. pbior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. 18.3.4 port b control registers h and l (pbcrh, pbcrl) port b control registers h and l (pbcrh, pbcrl) are 16-bit readable/writable registers that select the functions of the 16 multiplex pins in port b. pbcrh selects the functions of the pins for the upper 8 bits of port b, and pbcrl selects the functions of the pins for the lower 8 bits. pbcrh and pbcrl are initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. they are not initialized in software standby mode or sleep mode.
613 port b control register h (pbcrh) bit: 15 14 13 12 11 10 9 8 pb15 md1 pb15 md0 pb14 md1 pb14 md0 ? pb13 md pb12 md1 pb12 md0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pb11 md1 pb11 md0 pb10 md1 pb10 md0 pb9 md1 pb9 md0 pb8 md1 pb8 md0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w ? bits 15 and 14?b15 mode bits 1 and 0 (pb15md1, pb15md0): these bits select the function of pin pb15/puls5/sck2. bit 15: pb15md1 bit 14: pb15md0 description 0 0 general input/output (pb15) (initial value) 1 apc pulse output (puls5) 1 0 serial clock input/output (sck2) 1 reserved (do not set) ? bits 13 and 12?b14 mode bits 1 and 0 (pb14md1, pb14md0): these bits select the function of pin pb14/sck1/tclkb/t110. bit 13: pb14md1 bit 12: pb14md0 description 0 0 general input/output (pb14) (initial value) 1 serial clock input/output (sck1) 1 0 atu clock input (tclkb) 1 atu edge input (ti10) ? bit 11?eserved: this bit always reads 0. the write value should always be 0.
614 ? bit 10?b13 mode bit (pb13md): selects the function of pin pb13/sck0. bit 10: pb13md description 0 general input/output (pb13) (initial value) 1 serial clock input/output (sck0) ? bits 9 and 8?b12 mode bits 1 and 0 (pb12md1, pb12md0): these bits select the function of pin pb12/tclka/ ubctrg . bit 9: pb12md1 bit 8: pb12md0 description 0 0 general input/output (pb12) (initial value) 1 atu clock input (tclka) 1 0 trigger pulse output ( ubctrg ? bits 7 and 6?b11 mode bits 1 and 0 (pb11md1, pb11md0): these bits select the function of pin pb11/rxd4/hrxd0/to8h. bit 7: pb11md1 bit 6: pb11md0 description 0 0 general input/output (pb11) (initial value) 1 receive data input (rxd4) 1 0 hcan receive data input (hrxd) 1 atu one-shot pulse output (to8h) ? bits 5 and 4?b10 mode bits 1 and 0 (pb10md1, pb10md0): these bits select the function of pin pb10/txd4/htxd0/to8g. bit 5: pb10md1 bit 4: pb10md0 description 0 0 general input/output (pb10) (initial value) 1 transmit data output (txd4) 1 0 hcan transmit data output (htxd) 1 atu one-shot pulse output (to8g)
615 ? bits 3 and 2?b9 mode bits 1 and 0 (pb9md1, pb9md0): these bits select the function of pin pb9/rxd3/to8f. bit 3: pb9md1 bit 2: pb9md0 description 0 0 general input/output (pb9) (initial value) 1 receive data input (rxd3) 1 0 atu one-shot pulse output (to8f) 1 reserved (do not set) ? bits 1 and 0?b8 mode bits 1 and 0 (pb8md1, pb8md0): these bits select the function of pin pb8/txd3/to8e. bit 1: pb8md1 bit 0: pb8md0 description 0 0 general input/output (pb8) (initial value) 1 transmit data output (txd3) 1 0 atu one-shot pulse output (to8e) 1 reserved (do not set) port b control register l (pbcrl) bit: 15 14 13 12 11 10 9 8 pb7md1 pb7md0 pb6md1 pb6md0 pb5md1 pb5md0 pb4md1 pb4md0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ? pb3md ? pb2md ? pb1md ? pb0md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w
616 ? bits 15 and 14?b7 mode bits 1 and 0 (pb7md1, pb7md0): these bits select the function of pin pb7/to7d/to8d. bit 15: pb7md1 bit 14: pb7md0 description 0 0 general input/output (pb7) (initial value) 1 atu pwm output (to7d) 1 0 atu one-shot pulse output (to8d) 1 reserved (do not set) ? bits 13 and 12?b6 mode bits 1 and 0 (pb6md1, pb6md0): these bits select the function of pin pb6/to7c/to8c. bit 13: pb6md1 bit 12: pb6md0 description 0 0 general input/output (pb6) (initial value) 1 atu pwm output (to7c) 1 0 atu one-shot pulse output (to8c) 1 reserved (do not set) ? bits 11 and 10?b5 mode bits 1 and 0 (pb5md1, pb5md0): these bits select the function of pin pb5/to7b/to8b. bit 11: pb5md1 bit 10: pb5md0 description 0 0 general input/output (pb5) (initial value) 1 atu pwm output (to7b) 1 0 atu one-shot pulse output (to8b) 1 reserved (do not set) ? bits 9 and 8?b4 mode bits 1 and 0 (pb4md1, pb4md0): these bits select the function of pin pb4/to7a/to8a. bit 9: pb4md1 bit 8: pb4md0 description 0 0 general input/output (pb4) (initial value) 1 atu pwm output (to7a) 1 0 atu one-shot pulse output (to8a) 1 reserved (do not set) ? bit 7?eserved: this bit always reads 0. the write value should always be 0.
617 ? bit 6?b3 mode bit (pb3md): selects the function of pin pb3/to6d. bit 6: pb3md description 0 general input/output (pb3) (initial value) 1 atu pwm output (to6d) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?b2 mode bit (pb2md): selects the function of pin pb2/to6c. bit 4: pb2md description 0 general input/output (pb2) (initial value) 1 atu pwm output (to6c) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?b1 mode bit (pb1md): selects the function of pin pb1/to6b. bit 2: pb1md description 0 general input/output (pb1) (initial value) 1 atu pwm output (to6b) ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?b0 mode bit (pb0md): selects the function of pin pb0/to6a. bit 0: pb0md description 0 general input/output (pb0) (initial value) 1 atu pwm output (to6a)
618 18.3.5 port b invert register (pbir) bit: 15 14 13 12 11 10 9 8 pb15ir pb14ir pb13ir ? pb11ir pb10ir pb9ir pb8ir initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pb7ir pb6ir pb5ir pb4ir pb3ir pb2ir pb1ir pb0ir initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port b invert register (pbir) is a 16-bit readable/writable register that sets the port b inversion function. bits pb15ir to pb13ir and pb11ir to pb0ir correspond to pins pb15/puls5/sck2 to pb13/sck0 and pb11/rxd4/hrxd0/to8h to pb0/to6a. pbir is enabled when port b pins function as atu outputs or serial clock pins, and disabled otherwise. when port b pins function as atu outputs or serial clock pins, the value of a pin is inverted when the corresponding bit in pbir is set to 1. pbir is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. pbnir description 0 value is not inverted (initial value) 1 value is inverted n = 15 to 0
619 18.3.6 port c io register (pcior) bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ? ? ? pc4ior pc3ior pc2ior pc1ior pc0ior initial value: 0 0 0 0 0 0 0 0 r/w: r r r r/w r/w r/w r/w r/w the port c io register (pcior) is a 16-bit readable/writable register that selects the input/output direction of the 5 pins in port c. bits pc4ior to pc0ior correspond to pins pc4/ irq0 to pc0/txd1. pcior is enabled when port c pins function as general input/output pins (pc4 to pc0), and disabled otherwise. when port c pins function as pc4 to pc0, a pin becomes an output when the corresponding bit in pcior is set to 1, and an input when the bit is cleared to 0. pcior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
620 18.3.7 port c control register (pccr) the port c control register (pccr) is a 16-bit readable/writable register that selects the functions of the 5 multiplex pins in port c. pccr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. bit: 15 14 13 12 11 10 9 8 pc4md initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r/w bit: 7 6 5 4 3 2 1 0 pc3md pc2md pc1md pc0md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bits 15 to 9?eserved: these bits always read 0. the write value should always be 0. ? bit 8?c4 mode bit (pc4md): selects the function of pin pc4/ irq0 . bit 8: pc4md description 0 general input/output (pc4) (initial value) 1 interrupt request input ( irq0 ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?c3 mode bit (pc3md): selects the function of pin pc3/rxd2. bit 6: pc3md description 0 general input/output (pc3) (initial value) 1 receive data input (rxd2)
621 ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?c2 mode bit (pc2md): selects the function of pin pc2/txd2. bit 4: pc2md description 0 general input/output (pc2) (initial value) 1 transmit data output (txd2) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?c1 mode bit (pc1md): selects the function of pin pc1/rxd1. bit 2: pc1md description 0 general input/output (pc1) (initial value) 1 receive data input (rxd1) ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?c0 mode bit (pc0md): selects the function of pin pc0/txd1. bit 0: pc0md description 0 general input/output (pc0) (initial value) 1 transmit data output (txd1)
622 18.3.8 port d io register (pdior) bit: 15 14 13 12 11 10 9 8 ? ? pd13 ior pd12 ior pd11 ior pd10 ior pd9 ior pc8 ior initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pd7 ior pd6 ior pd5 ior pd4 ior pd3 ior pd2 ior pd1 ior pd0 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port d io register (pdior) is a 16-bit readable/writable register that selects the input/output direction of the 14 pins in port d. bits pd13ior to pd0ior correspond to pins pd13/puls6/htxd0/htxd1 to pd0/tio1a. pdior is enabled when port d pins function as general input/output pins (pd13 to pd0) or timer input/output pins, and disabled otherwise. when port d pins function as pd13 to pd0 or timer input/output pins, a pin becomes an output when the corresponding bit in pdior is set to 1, and an input when the bit is cleared to 0. pdior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
623 18.3.9 port d control registers h and l (pdcrh, pdcrl) port d control registers h and l (pdcrh, pdcrl) are 16-bit readable/writable registers that select the functions of the 14 multiplex pins in port d. pdcrh selects the functions of the pins for the upper 6 bits of port d, and pdcrl selects the functions of the pins for the lower 8 bits. pdcrh and pdcrl are initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. they are not initialized in software standby mode or sleep mode. port d control register h (pdcrh) bit: 15 14 13 12 11 10 9 8 ? ? ? ? pd13 md1 pd13 md0 ? pd12 md initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pd11 md ? pd10 md ? pd9 md ? pd8 md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bits 15 to 12?eserved: these bits always read 0. the write value should always be 0. ? bits 11 and 10?d13 mode bits 1 and 0 (pd13md1, pd13md0): these bits select the function of pin pd13/puls6/htxd. bit 11: pd13md1 bit 10: pd13md0 description 0 0 general input/output (pd13) (initial value) 1 apc pulse output (puls6) 1 0 hcan transmit data output (htxd) 1 reserved (do not set) ? bit 9?eserved: this bit always reads 0. the write value should always be 0.
624 ? bit 8?d12 mode bit (pd12md): selects the function of pin pd12/puls4. bit 8: pd12md description 0 general input/output (pd12) (initial value) 1 apc pulse output (puls4) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?d11 mode bit (pd11md): selects the function of pin pd11/puls3. bit 6: pd12md description 0 general input/output (pd11) (initial value) 1 apc pulse output (puls3) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?d10 mode bit (pd10md): selects the function of pin pd10/puls2. bit 4: pd10md description 0 general input/output (pd10) (initial value) 1 apc pulse output (puls2) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?d9 mode bit (pd9md): selects the function of pin pd9/puls1. bit 2: pd9md description 0 general input/output (pd9) (initial value) 1 apc pulse output (puls1) ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?d8 mode bit (pd8md): selects the function of pin pd8/puls0. bit 0: pd8md description 0 general input/output (pd8) (initial value) 1 apc pulse output (puls0)
625 port d control register l (pdcrl) bit: 15 14 13 12 11 10 9 8 ? pd7md ? pd6md ? pd5md ? pd4md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pd3md ? pd2md ? pd1md ? pd0md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?d7 mode bit (pd7md): selects the function of pin pd7/tio1h. bit 14: pd7md description 0 general input/output (pd7) (initial value) 1 atu input capture input/output compare output (tio1h) ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?d6 mode bit (pd6md): selects the function of pin pd6/tio1g. bit 12: pd6md description 0 general input/output (pd6) (initial value) 1 atu input capture input/output compare output (tio1g) ? bit 11?eserved: this bit always reads 0. the write value should always be 0. ? bit 10?d5 mode bit (pd5md): selects the function of pin pd5/tio1f. bit 10: pd5md description 0 general input/output (pd5) (initial value) 1 atu input capture input/output compare output (tio1f) ? bit 9?eserved: this bit always reads 0. the write value should always be 0.
626 ? bit 8?d4 mode bit (pd4md): selects the function of pin pd4/tio1e. bit 8: pd4md description 0 general input/output (pd4) (initial value) 1 atu input capture input/output compare output (tio1e) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?d3 mode bit (pd3md): selects the function of pin pd3/tio1d. bit 6: pd3md description 0 general input/output (pd3) (initial value) 1 atu input capture input/output compare output (tio1d) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?d2 mode bit (pd2md): selects the function of pin pd2/tio1c. bit 4: pd2md description 0 general input/output (pd2) (initial value) 1 atu input capture input/output compare output (tio1c) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?d1 mode bit (pd1md): selects the function of pin pd1/tio1b. bit 2: pd1md description 0 general input/output (pd1) (initial value) 1 atu input capture input/output compare output (tio1b) ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?d0 mode bit (pd0md): selects the function of pin pd0/tio1a. bit 0: pd0md description 0 general input/output (pd0) (initial value) 1 atu input capture input/output compare output (tio1a)
627 18.3.10 port e io register (peior) bit: 15 14 13 12 11 10 9 8 pe15 ior pe14 ior pe13 ior pe12 ior pe11 ior pe10 ior pe9 ior pe8 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pe7 ior pe6 ior pe5 ior pe4 ior pe3 ior pe2 ior pe1 ior pe0 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port e io register (peior) is a 16-bit readable/writable register that selects the input/output direction of the 16 pins in port e. bits pe15ior to pe0ior correspond to pins pe15/a15 to pe0/a0. peior is enabled when port e pins function as general input/output pins (pe15 to pe0), and disabled otherwise. when port e pins function as pe15 to pe0, a pin becomes an output when the corresponding bit in peior is set to 1, and an input when the bit is cleared to 0. peior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
628 18.3.11 port e control register (pecr) bit: 15 14 13 12 11 10 9 8 pe15 md pe14 md pe13 md pe12 md pe11 md pe10 md pe9 md pe8 md initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pe7 md pe6 md pe5 md pe4 md pe3 md pe2 md pe1 md pe0 md initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port e control register (pecr) is a 16-bit readable/writable register that selects the functions of the 16 multiplex pins in port e. pecr settings are not valid in all operating modes. 1. expanded mode with on-chip rom disabled port e pins function as address output pins, and pecr settings are invalid. 2. expanded mode with on-chip rom enabled port e pins are multiplexed as address output pins and general input/output pins. pecr settings are valid. 3. single-chip mode port e pins function as general input/output pins, and pecr settings are invalid. pecr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. ? bit 15?e15 mode bit (pe15md): selects the function of pin pe15/a15. description bit 15: pe15md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a15) (initial value) general input/output (pe15) (initial value) general input/output (pe15) (initial value) 1 address output (a15) address output (a15) general input/output (pe15)
629 ? bit 14?e14 mode bit (pe14md): selects the function of pin pe14/a14. description bit 14: pe14md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a14) (initial value) general input/output (pe14) (initial value) general input/output (pe14) (initial value) 1 address output (a14) address output (a14) general input/output (pe14) ? bit 13?e13 mode bit (pe13md): selects the function of pin pe13/a13. description bit 13: pe13md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a13) (initial value) general input/output (pe13) (initial value) general input/output (pe13) (initial value) 1 address output (a13) address output (a13) general input/output (pe13) ? bit 12?e12 mode bit (pe12md): selects the function of pin pe12/a12. description bit 12: pe12md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a12) (initial value) general input/output (pe12) (initial value) general input/output (pe12) (initial value) 1 address output (a12) address output (a12) general input/output (pe12) ? bit 11?e11 mode bit (pe11md): selects the function of pin pe11/a11. description bit 11: pe11md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a11) (initial value) general input/output (pe11) (initial value) general input/output (pe11) (initial value) 1 address output (a11) address output (a11) general input/output (pe11)
630 ? bit 10?e10 mode bit (pe10md): selects the function of pin pe10/a10. description bit 10: pe10md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a10) (initial value) general input/output (pe10) (initial value) general input/output (pe10) (initial value) 1 address output (a10) address output (a10) general input/output (pe10) ? bit 9?e9 mode bit (pe9md): selects the function of pin pe9/a9. description bit 9: pe9md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a9) (initial value) general input/output (pe9) (initial value) general input/output (pe9) (initial value) 1 address output (a9) address output (a9) general input/output (pe9) ? bit 8?e8 mode bit (pe8md): selects the function of pin pe8/a8. description bit 8: pe8md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a8) (initial value) general input/output (pe8) (initial value) general input/output (pe8) (initial value) 1 address output (a8) address output (a8) general input/output (pe8) ? bit 7?e7 mode bit (pe7md): selects the function of pin pe7/a7. description bit 7: pe7md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a7) (initial value) general input/output (pe7) (initial value) general input/output (pe7) (initial value) 1 address output (a7) address output (a7) general input/output (pe7)
631 ? bit 6?e6 mode bit (pe6md): selects the function of pin pe6/a6. description bit 6: pe6md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a6) (initial value) general input/output (pe6) (initial value) general input/output (pe6) (initial value) 1 address output (a6) address output (a6) general input/output (pe6) ? bit 5?e5 mode bit (pe5md): selects the function of pin pe5/a5. description bit 5: pe5md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a5) (initial value) general input/output (pe5) (initial value) general input/output (pe5) (initial value) 1 address output (a5) address output (a5) general input/output (pe5) ? bit 4?e4 mode bit (pe4md): selects the function of pin pe4/a4. description bit 4: pe4md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a4) (initial value) general input/output (pe4) (initial value) general input/output (pe4) (initial value) 1 address output (a4) address output (a4) general input/output (pe4) ? bit 3?e3 mode bit (pe3md): selects the function of pin pe3/a3. description bit 3: pe3md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a3) (initial value) general input/output (pe3) (initial value) general input/output (pe3) (initial value) 1 address output (a3) address output (a3) general input/output (pe3)
632 ? bit 2?e2 mode bit (pe2md): selects the function of pin pe2/a2. description bit 2: pe2md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a2) (initial value) general input/output (pe2) (initial value) general input/output (pe2) (initial value) 1 address output (a2) address output (a2) general input/output (pe2) ? bit 1?e1 mode bit (pe1md): selects the function of pin pe1/a1. description bit 1: pe1md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a1) (initial value) general input/output (pe1) (initial value) general input/output (pe1) (initial value) 1 address output (a1) address output (a1) general input/output (pe1) ? bit 0?e0 mode bit (pe0md): selects the function of pin pe0/a0. description bit 0: pe0md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a0) (initial value) general input/output (pe0) (initial value) general input/output (pe0) (initial value) 1 address output (a0) address output (a0) general input/output (pe0)
633 18.3.12 port f io register (pfior) bit: 15 14 13 12 11 10 9 8 pf15 ior pf14 ior pf13 ior pf12 ior pf11 ior pf10 ior pf9 ior pf8 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pf7 ior pf6 ior pf5 ior pf4 ior pf3 ior pf2 ior pf1 ior pf0 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port f io register (pfior) is a 16-bit readable/writable register that selects the input/output direction of the 16 pins in port f. bits pf15ior to pf0ior correspond to pins pf15/ breq to pf0/a16. pfior is enabled when port f pins function as general input/output pins (pf15 to pf0), and disabled otherwise. when port f pins function as pf15 to pf0, a pin becomes an output when the corresponding bit in pfior is set to 1, and an input when the bit is cleared to 0. pfior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
634 18.3.13 port f control registers h and l (pfcrh, pfcrl) port f control registers h and l (pfcrh, pfcrl) are 16-bit readable/writable registers that select the functions of the 16 multiplex pins in port f and the function of the ck pin. pfcrh selects the functions of the pins for the upper 8 bits of port f, and pfcrl selects the functions of the pins for the lower 8 bits. pfcrh and pfcrl are initialized to h'0015 and h'5000, respectively, by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. they are not initialized in software standby mode or sleep mode. port f control register h (pfcrh) bit: 15 14 13 12 11 10 9 8 ckhiz pf15md ? pf14md ? pf13md ? pf12md initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pf11md ? pf10md ? pf9md ? pf8md initial value: 0 0 0 1 0 1 0 1 r/w: r r/w r r/w r r/w r r/w ? bit 15?khiz bit: selects the function of pin ck. bit: ckhiz description 0 ck pin output (initial value) 1 ck pin hi-z ? bit 14?f15 mode bit (pf15md): selects the function of pin pf15/ breq . description bit 14: pf15md expanded mode single-chip mode 0 general input/output (pf15) (initial value) general input/output (pf15) (initial value) 1 bus request input ( breq
635 ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?f14 mode bit (pf14md): selects the function of pin pf14/ back . description bit 12: pf14md expanded mode single-chip mode 0 general input/output (pf14) (initial value) general input/output (pf14) (initial value) 1 bus acknowledge output ( back ? bit 11?eserved: this bit always reads 0. the write value should always be 0. ? bit 10?f13 mode bit (pf13md): selects the function of pin pf13/ cs3 . description bit 10: pf13md expanded mode single-chip mode 0 general input/output (pf13) (initial value) general input/output (pf13) (initial value) 1 chip select output ( cs3 ? bit 9?eserved: this bit always reads 0. the write value should always be 0. ? bit 8?f12 mode bit (pf12md): selects the function of pin pf12/ cs2 . description bit 8: pf12md expanded mode single-chip mode 0 general input/output (pf12) (initial value) general input/output (pf12) (initial value) 1 chip select output ( cs2 ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?f11 mode bit (pf11md): selects the function of pin pf11/ cs1 . description bit 6: pf11md expanded mode single-chip mode 0 general input/output (pf11) (initial value) general input/output (pf11) (initial value) 1 chip select output ( cs1
636 ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?f10 mode bit (pf10md): selects the function of pin pf10/ cs0 . description bit 4: pf10md expanded mode single-chip mode 0 general input/output (pf10) general input/output (pf10) 1 chip select output ( cs0 ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?f9 mode bit (pf9md): selects the function of pin pf9/ rd . description bit 2: pf9md expanded mode single-chip mode 0 general input/output (pf9) general input/output (pf9) 1 read output ( rd ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?f8 mode bit (pf8md): selects the function of pin pf8/ wait . description bit 0: pf8md expanded mode single-chip mode 0 general input/output (pf8) general input/output (pf8) 1 wait state input ( wait
637 port f control register l (pfcrl) bit: 15 14 13 12 11 10 9 8 ? pf7md ? pf6md pf5md1 pf5md0 ? pf4md initial value: 0 1 0 1 0 0 0 0 r/w: r r/w r r/w r/w r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pf3md ? pf2md ? pf1md ? pf0md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?f7 mode bit (pf7md): selects the function of pin pf7/ wrh . description bit 14: pf7md expanded mode single-chip mode 0 general input/output (pf7) general input/output (pf7) 1 upper write output ( wrh ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?f6 mode bit (pf6md): selects the function of pin pf6/ wrl . description bit 12: pf6md expanded mode single-chip mode 0 general input/output (pf6) general input/output (pf6) 1 lower write output ( wrl
638 ? bits 11 and 10?f5 mode bits 1 and 0 (pf5md1, pf5md0): these bits select the function of pin pf5/a21/ pod . description bit 11: pf5md1 bit 10: pf5md0 expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 0 address output (a21) (initial value) general input/output (pf5) (initial value) general input/output (pf5) (initial value) 1 address output (a21) address output (a21) general input/output (pf5) 1 0 address output (a21) port output disable input ( pod pod ? bit 9?eserved: this bit always reads 0. the write value should always be 0. ? bit 8?f4 mode bit (pf4md): selects the function of pin pf4/a20. description bit 8: pf4md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a20) (initial value) general input/output (pf4) (initial value) general input/output (pf4) (initial value) 1 address output (a20) address output (a20) general input/output (pf4) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?f3 mode bit (pf3md): selects the function of pin pf3/a19. description bit 6: pf3md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a19) (initial value) general input/output (pf3) (initial value) general input/output (pf3) (initial value) 1 address output (a19) address output (a19) general input/output (pf3)
639 ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?f2 mode bit (pf2md): selects the function of pin pf2/a18. description bit 4: pf2md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a18) (initial value) general input/output (pf2) (initial value) general input/output (pf2) (initial value) 1 address output (a18) address output (a18) general input/output (pf2) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?f1 mode bit (pf1md): selects the function of pin pf1/a17. description bit 2: pf1md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a17) (initial value) general input/output (pf1) (initial value) general input/output (pf1) (initial value) 1 address output (a17) address output (a17) general input/output (pf1) ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?f0 mode bit (pf0md): selects the function of pin pf0/a16. description bit 0: pf0md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 address output (a16) (initial value) general input/output (pf0) (initial value) general input/output (pf0) (initial value) 1 address output (a16) address output (a16) general input/output (pf0)
640 18.3.14 port g io register (pgior) bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ? ? ? ? pg3ior pg2ior pg1ior pg0ior initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w the port g io register (pgior) is a 16-bit readable/writable register that selects the input/output direction of the 4 pins in port g. bits pg3ior to pg0ior correspond to pins pg3/ irq3 / adtrg0 to pg0/puls7/hrxd0/hrxd1. when port g pins function as pg3 to pg0, a pin becomes an output when the corresponding bit in pgior is set to 1, and an input when the bit is cleared to 0. pgior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
641 18.3.15 port g control register (pgcr) the port g control register (pgcr) is a 16-bit readable/writable register that selects the functions of the 4 multiplex pins in port g. pgcr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. bit: 15 14 13 12 11 10 9 8 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 pg3md1 pg3md0 pg2md1 pg2md0 pg1md pg0md1 pg0md0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r r/w r/w r/w ? bits 15 to 8?eserved: these bits always read 0. the write value should always be 0. ? bits 7 and 6?g3 mode bits 1 and 0 (pg3md1, pg3md0): these bits select the function of pin pg3/ irq3 / adtrg0 . bit 7: pg3md1 bit 6: pg3md0 description 0 0 general input/output (pg3) (initial value) 1 interrupt request input ( irq3 adtrg0 ? bits 5 and 4?g2 mode bits 1 and 0 (pg2md1, pg2md0): these bits select the function of pin pg2/ irq2 . bit 5: pg2md1 bit 4: pg2md0 description 0 0 general input/output (pg2) (initial value) 1 interrupt request input ( irq2
642 ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?g1 mode bit (pg1md): selects the function of pin pg1/ irq1 . bit 2: pg1md description 0 general input/output (pg1) (initial value) 1 interrupt request input ( irq1 ? bits 1 and 0?g0 mode bits 1 and 0 (pg0md1, pg2md0): these bits select the function of pin pg0/puls7/hrxd0. bit 1: pg0md1 bit 0: pg0md0 description 0 0 general input/output (pg0) (initial value) 1 apc pulse output (puls7) 1 0 hcan receive data input (hrxd) 1 reserved (do not set)
643 18.3.16 port h io register (phior) bit: 15 14 13 12 11 10 9 8 ph15 ior ph14 ior ph13 ior ph12 ior ph11 ior ph10 ior ph9 ior ph8 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ph7 ior ph6 ior ph5 ior ph4 ior ph3 ior ph2 ior ph1 ior ph0 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port h io register (phior) is a 16-bit readable/writable register that selects the input/output direction of the 16 pins in port h. bits ph15ior to ph0ior correspond to pins ph15/d15 to ph0/d0. phior is enabled when port h pins function as general input/output pins (ph15 to ph0), and disabled otherwise. when port h pins function as ph15 to ph0, a pin becomes an output when the corresponding bit in phior is set to 1, and an input when the bit is cleared to 0. phior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
644 18.3.17 port h control register (phcr) bit: 15 14 13 12 11 10 9 8 ph15 md ph14 md ph13 md ph12 md ph11 md ph10 md ph9 md ph8 md initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ph7 md ph6 md ph5 md ph4 md ph3 md ph2 md ph1 md ph0 md initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port h control register (phcr) is a 16-bit readable/writable register that selects the functions of the 16 multiplex pins in port h. phcr settings are not valid in all operating modes. 1. expanded mode with on-chip rom disabled (area 0: 8-bit bus) port h pins d0 to d7 function as data input/output pins, and phcr settings are invalid. 2. expanded mode with on-chip rom disabled (area 0: 16-bit bus) port h pins function as data input/output pins, and phcr settings are invalid. 3. expanded mode with on-chip rom enabled port h pins are multiplexed as data input/output pins and general input/output pins. phcr settings are valid. 4. single-chip mode port h pins function as general input/output pins, and phcr settings are invalid. phcr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
645 ? bit 15?h15 mode bit (ph15md): selects the function of pin ph15/d15. description bit 15: ph15md expanded mode with rom disabled area 0: 8 bits expanded mode with rom disabled area 0: 16 bits expanded mode with rom enabled single-chip mode 0 general input/output (ph15) (initial value) data input/output (d15) (initial value) general input/output (ph15) (initial value) general input/output (ph15) (initial value) 1 data input/output (d15) data input/output (d15) data input/output (d15) general input/output (ph15) ? bit 14?h14 mode bit (ph14md): selects the function of pin ph14/d14. description bit 14: ph14md expanded mode with rom disabled area 0: 8 bits expanded mode with rom disabled area 0: 16 bits expanded mode with rom enabled single-chip mode 0 general input/output (ph14) (initial value) data input/output (d14) (initial value) general input/output (ph14) (initial value) general input/output (ph14) (initial value) 1 data input/output (d14) data input/output (d14) data input/output (d14) general input/output (ph14) ? bit 13?h13 mode bit (ph13md): selects the function of pin ph13/d13. description bit 13: ph13md expanded mode with rom disabled area 0: 8 bits expanded mode with rom disabled area 0: 16 bits expanded mode with rom enabled single-chip mode 0 general input/output (ph13) (initial value) data input/output (d13) (initial value) general input/output (ph13) (initial value) general input/output (ph13) (initial value) 1 data input/output (d13) data input/output (d13) data input/output (d13) general input/output (ph13)
646 ? bit 12?h12 mode bit (ph12md): selects the function of pin ph12/d12. description bit 12: ph12md expanded mode with rom disabled area 0: 8 bits expanded mode with rom disabled area 0: 16 bits expanded mode with rom enabled single-chip mode 0 general input/output (ph12) (initial value) data input/output (d12) (initial value) general input/output (ph12) (initial value) general input/output (ph12) (initial value) 1 data input/output (d12) data input/output (d12) data input/output (d12) general input/output (ph12) ? bit 11?h11 mode bit (ph11md): selects the function of pin ph11/d11. description bit 11: ph11md expanded mode with rom disabled area 0: 8 bits expanded mode with rom disabled area 0: 16 bits expanded mode with rom enabled single-chip mode 0 general input/output (ph11) (initial value) data input/output (d11) (initial value) general input/output (ph11) (initial value) general input/output (ph11) (initial value) 1 data input/output (d11) data input/output (d11) data input/output (d11) general input/output (ph11) ? bit 10?h10 mode bit (ph10md): selects the function of pin ph10/d10. description bit 10: ph10md expanded mode with rom disabled area 0: 8 bits expanded mode with rom disabled area 0: 16 bits expanded mode with rom enabled single-chip mode 0 general input/output (ph10) (initial value) data input/output (d10) (initial value) general input/output (ph10) (initial value) general input/output (ph10) (initial value) 1 data input/output (d10) data input/output (d10) data input/output (d10) general input/output (ph10)
647 ? bit 9?h9 mode bit (ph9md): selects the function of pin ph9/d9. description bit 9: ph9md expanded mode with rom disabled area 0: 8 bits expanded mode with rom disabled area 0: 16 bits expanded mode with rom enabled single-chip mode 0 general input/output (ph9) (initial value) data input/output (d9) (initial value) general input/output (ph9) (initial value) general input/output (ph9) (initial value) 1 data input/output (d9) data input/output (d9) data input/output (d9) general input/output (ph9) ? bit 8?h8 mode bit (ph8md): selects the function of pin ph8/d8. description bit 8: ph8md expanded mode with rom disabled area 0: 8 bits expanded mode with rom disabled area 0: 16 bits expanded mode with rom enabled single-chip mode 0 general input/output (ph8) (initial value) data input/output (d8) (initial value) general input/output (ph8) (initial value) general input/output (ph8) (initial value) 1 data input/output (d8) data input/output (d8) data input/output (d8) general input/output (ph8) ? bit 7?h7 mode bit (ph7md): selects the function of pin ph7/d7. description bit 7: ph7md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 data input/output (d7) (initial value) general input/output (ph7) (initial value) general input/output (ph7) (initial value) 1 data input/output (d7) data input/output (d7) general input/output (ph7)
648 ? bit 6?h6 mode bit (ph6md): selects the function of pin ph6/d6. description bit 6: ph6md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 data input/output (d6) (initial value) general input/output (ph6) (initial value) general input/output (ph6) (initial value) 1 data input/output (d6) data input/output (d6) general input/output (ph6) ? bit 5?h5 mode bit (ph5md): selects the function of pin ph5/d5. description bit 5: ph5md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 data input/output (d5) (initial value) general input/output (ph5) (initial value) general input/output (ph5) (initial value) 1 data input/output (d5) data input/output (d5) general input/output (ph5) ? bit 4?h4 mode bit (ph4md): selects the function of pin ph4/d4. description bit 4: ph4md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 data input/output (d4) (initial value) general input/output (ph4) (initial value) general input/output (ph4) (initial value) 1 data input/output (d4) data input/output (d4) general input/output (ph4) ? bit 3?h3 mode bit (ph3md): selects the function of pin ph3/d3. description bit 3: ph3md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 data input/output (d3) (initial value) general input/output (ph3) (initial value) general input/output (ph3) (initial value) 1 data input/output (d3) data input/output (d3) general input/output (ph3)
649 ? bit 2?h2 mode bit (ph2md): selects the function of pin ph2/d2. description bit 2: ph2md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 data input/output (d2) (initial value) general input/output (ph2) (initial value) general input/output (ph2) (initial value) 1 data input/output (d2) data input/output (d2) general input/output (ph2) ? bit 1?h1 mode bit (ph1md): selects the function of pin ph1/d1. description bit 1: ph1md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 data input/output (d1) (initial value) general input/output (ph1) (initial value) general input/output (ph1) (initial value) 1 data input/output (d1) data input/output (d1) general input/output (ph1) ? bit 0?h0 mode bit (ph0md): selects the function of pin ph0/d0. description bit 0: ph0md expanded mode with rom disabled expanded mode with rom enabled single-chip mode 0 data input/output (d0) (initial value) general input/output (ph0) (initial value) general input/output (ph0) (initial value) 1 data input/output (d0) data input/output (d0) general input/output (ph0)
650 18.3.18 port j io register (pjior) bit: 15 14 13 12 11 10 9 8 pj15 ior pj14 ior pj13 ior pj12 ior pj11 ior pj10 ior pj9 ior pj8 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pj7 ior pj6 ior pj5 ior pj4 ior pj3 ior pj2 ior pj1 ior pj0 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port j io register (pjior) is a 16-bit readable/writable register that selects the input/output direction of the 16 pins in port j. bits pj15ior to pj0ior correspond to pins pj15/ti9f to pj0/tio2a. pjior is enabled when port j pins function as general input/output pins (pj15 to pj0) or atu input/output pins, and disabled otherwise. when port j pins function as pj15 to pj0 or atu input/output pins, a pin becomes an output when the corresponding bit in pjior is set to 1, and an input when the bit is cleared to 0. pjior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
651 18.3.19 port j control registers h and l (pjcrh, pjcrl) port j control registers h and l (pjcrh, pjcrl) are 16-bit readable/writable registers that select the functions of the 16 multiplex pins in port j. pjcrh selects the functions of the pins for the upper 8 bits of port j, and pjcrl selects the functions of the pins for the lower 8 bits. pjcrh and pjcrl are initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. they are not initialized in software standby mode or sleep mode. port j control register h (pjcrh) bit: 15 14 13 12 11 10 9 8 ? pj15md ? pj14md ? pj13md ? pj12md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pj11md ? pj10md ? pj9md ? pj8md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?j15 mode bit (pj15md): selects the function of pin pj15/ti9f. bit 14: pj15md description 0 general input/output (pj15) (initial value) 1 atu event counter input (ti9f) ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?j14 mode bit (pj14md): selects the function of pin pj14/ti9e. bit 12: pj14md description 0 general input/output (pj14) (initial value) 1 atu event counter input (ti9e)
652 ? bit 11?eserved: this bit always reads 0. the write value should always be 0. ? bit 10?j13 mode bit (pj13md): selects the function of pin pj13/ti9d. bit 10: pj13md description 0 general input/output (pj13) (initial value) 1 atu event counter input (ti9d) ? bit 9?eserved: this bit always reads 0. the write value should always be 0. ? bit 8?j12 mode bit (pj12md): selects the function of pin pj12/ti9c. bit 8: pj12md description 0 general input/output (pj12) (initial value) 1 atu event counter input (ti9c) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?j11 mode bit (pj11md): selects the function of pin pj11/ti9b. bit 6: pj11md description 0 general input/output (pj11) (initial value) 1 atu event counter input (ti9b) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?j10 mode bit (pj10md): selects the function of pin pj10/ti9a. bit 4: pj10md description 0 general input/output (pj10) (initial value) 1 atu event counter input (ti9a) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?j9 mode bit (pj9md): selects the function of pin pj9/tio5d. bit 2: pj9md description 0 general input/output (pj9) (initial value) 1 atu input capture input/output compare output (tio5d)
653 ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?j8 mode bit (pj8md): selects the function of pin pj8/tio5c. bit 0: pj8md description 0 general input/output (pj8) (initial value) 1 atu input capture input/output compare output (tio5c) port j control register l (pjcrl) bit: 15 14 13 12 11 10 9 8 ? pj7md ? pj6md ? pj5md ? pj4md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pj3md ? pj2md ? pj1md ? pj0md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?j7 mode bit (pj7md): selects the function of pin pj7/tio2h. bit 14: pj7md description 0 general input/output (pj7) (initial value) 1 atu input capture input/output compare output (tio2h) ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?j6 mode bit (pj6md): selects the function of pin pj6/tio2g. bit 12: pj6md description 0 general input/output (pj6) (initial value) 1 atu input capture input/output compare output (tio2g)
654 ? bit 11?eserved: this bit always reads 0. the write value should always be 0. ? bit 10?j5 mode bit (pj5md): selects the function of pin pj5/tio2f. bit 10: pj5md description 0 general input/output (pj5) (initial value) 1 atu input capture input/output compare output (tio2f) ? bit 9?eserved: this bit always reads 0. the write value should always be 0. ? bit 8?j4 mode bit (pj4md): selects the function of pin pj4/tio2e. bit 8: pj4md description 0 general input/output (pj4) (initial value) 1 atu input capture input/output compare output (tio2e) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?j3 mode bit (pj3md): selects the function of pin pj3/tio2d. bit 6: pj3md description 0 general input/output (pj3) (initial value) 1 atu input capture input/output compare output (tio2d) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?j2 mode bit (pj2md): selects the function of pin pj2/tio2c. bit 4: pj2md description 0 general input/output (pj2) (initial value) 1 atu input capture input/output compare output (tio2c) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?j1 mode bit (pj1md): selects the function of pin pj1/tio2b. bit 2: pj1md description 0 general input/output (pj1) (initial value) 1 atu input capture input/output compare output (tio2b)
655 ? bit 1?eserved: this bit always reads 0. the write value should always be 0. ? bit 0?j0 mode bit (pj0md): selects the function of pin pj0/tio2a. bit 0: pj0md description 0 general input/output (pj0) (initial value) 1 atu input capture input/output compare output (tio2a) 18.3.20 port k io register (pkior) bit: 15 14 13 12 11 10 9 8 pk15 ior pk14 ior pk13 ior pk12 ior pk11 ior pk10 ior pk9 ior pk8 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pk7 ior pk6 ior pk5 ior pk4 ior pk3 ior pk2 ior pk1 ior pk0 ior initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port k io register (pkior) is a 16-bit readable/writable register that selects the input/output direction of the 16 pins in port k. bits pk15ior to pk0ior correspond to pins pk15/to8p to pk0/to8a. pkior is enabled when port k pins function as general input/output pins (pk15 to pk0), and disabled otherwise. when port k pins function as pk15 to pk0, a pin becomes an output when the corresponding bit in pkior is set to 1, and an input when the bit is cleared to 0. pkior is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
656 18.3.21 port k control registers h and l (pkcrh, pkcrl) port k control registers h and l (pkcrh, pkcrl) are 16-bit readable/writable registers that select the functions of the 16 multiplex pins in port k. pkcrh selects the functions of the pins for the upper 8 bits of port k, and pkcrl selects the functions of the pins for the lower 8 bits. pkcrh and pkcrl are initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. they are not initialized in software standby mode or sleep mode. port k control register h (pkcrh) bit: 15 14 13 12 11 10 9 8 ? pk15 md ? pk14 md ? pk13 md ? pk12 md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pk11 md ? pk10 md ? pk9 md ? pk8 md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?k15 mode bit (pk15md): selects the function of pin pk15/to8p. bit 14: pk15md description 0 general input/output (pk15) (initial value) 1 atu one-shot pulse output (to8p) ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?k14 mode bit (pk14md): selects the function of pin pk14/to8o. bit 12: pk14md description 0 general input/output (pk14) (initial value) 1 atu one-shot pulse output (to8o) ? bit 11?eserved: this bit always reads 0. the write value should always be 0.
657 ? bit 10?k13 mode bit (pk13md): selects the function of pin pk13/to8n. bit 10: pk13md description 0 general input/output (pk13) (initial value) 1 atu one-shot pulse output (to8n) ? bit 9?eserved: this bit always reads 0. the write value should always be 0. ? bit 8?k12 mode bit (pk12md): selects the function of pin pk12/to8m. bit 8: pk12md description 0 general input/output (pk12) (initial value) 1 atu one-shot pulse output (to8m) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?k11 mode bit (pk11md): selects the function of pin pk11/to8l. bit 6: pk11md description 0 general input/output (pk11) (initial value) 1 atu one-shot pulse output (to8l) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?k10 mode bit (pk10md): selects the function of pin pk10/to8k. bit 4: pk10md description 0 general input/output (pk10) (initial value) 1 atu one-shot pulse output (to8k) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?k9 mode bit (pk9md): selects the function of pin pk9/to8j. bit 2: pk9md description 0 general input/output (pk9) (initial value) 1 atu one-shot pulse output (to8j) ? bit 1?eserved: this bit always reads 0. the write value should always be 0.
658 ? bit 0?k8 mode bit (pk8md): selects the function of pin pk8/to8i. bit 0: pk8md description 0 general input/output (pk8) (initial value) 1 atu one-shot pulse output (to8i) port k control register l (pkcrl) bit: 15 14 13 12 11 10 9 8 ? pk7md ? pk6md ? pk5md ? pk4md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w bit: 7 6 5 4 3 2 1 0 ? pk3md ? pk2md ? pk1md ? pk0md initial value: 0 0 0 0 0 0 0 0 r/w: r r/w r r/w r r/w r r/w ? bit 15?eserved: this bit always reads 0. the write value should always be 0. ? bit 14?k7 mode bit (pk7md): selects the function of pin pk7/to8h. bit 14: pk7md description 0 general input/output (pk7) (initial value) 1 atu one-shot pulse output (to8h) ? bit 13?eserved: this bit always reads 0. the write value should always be 0. ? bit 12?k6 mode bit (pk6md): selects the function of pin pk6/to8g. bit 12: pk6md description 0 general input/output (pk6) (initial value) 1 atu one-shot pulse output (to8g) ? bit 11?eserved: this bit always reads 0. the write value should always be 0.
659 ? bit 10?k5 mode bit (pk5md): selects the function of pin pk5/to8f. bit 10: pk5md description 0 general input/output (pk5) (initial value) 1 atu one-shot pulse output (to8f) ? bit 9?eserved: this bit always reads 0. the write value should always be 0. ? bit 8?k4 mode bit (pk4md): selects the function of pin pk4/to8e. bit 8: pk4md description 0 general input/output (pk4) (initial value) 1 atu one-shot pulse output (to8e) ? bit 7?eserved: this bit always reads 0. the write value should always be 0. ? bit 6?k3 mode bit (pk3md): selects the function of pin pk3/to8d. bit 6: pk3md description 0 general input/output (pk3) (initial value) 1 atu one-shot pulse output (to8d) ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bit 4?k2 mode bit (pk2md): selects the function of pin pk2/to8c. bit 4: pk2md description 0 general input/output (pk2) (initial value) 1 atu one-shot pulse output (to8c) ? bit 3?eserved: this bit always reads 0. the write value should always be 0. ? bit 2?k1 mode bit (pk1md): selects the function of pin pk1/to8b. bit 2: pk1md description 0 general input/output (pk1) (initial value) 1 atu one-shot pulse output (to8b) ? bit 1?eserved: this bit always reads 0. the write value should always be 0.
660 ? bit 0?k0 mode bit (pk0md): selects the function of pin pk0/to8a. bit 0: pk0md description 0 general input/output (pk0) (initial value) 1 atu one-shot pulse output (to8a) 18.3.22 port k invert register (pkir) bit: 15 14 13 12 11 10 9 8 pk15ir pk14ir pk13ir pk12ir pk11ir pk10ir pk9ir pk8ir initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pk7ir pk6ir pk5ir pk4ir pk3ir pk2ir pk1ir pk0ir initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port k invert register (pkir) is a 16-bit readable/writable register that sets the port k inversion function. bits pk15ir to pk0ir correspond to pins pk15/to8p to pk0/to8a. pkir is enabled when port k pins function as atu outputs, and disabled otherwise. when port k pins function as atu outputs, the value of a pin is inverted when the corresponding bit in pkir is set to 1. pkir is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. pknir description 0 value is not inverted (initial value) 1 value is inverted n = 15 to 0
661 section 19 i/o ports (i/o) 19.1 overview the sh7052f/sh7053f/sh7054f has 10 ports: a, b, c, d, e, f, g, h, j and k, all supporting both input and output. ports a b, e, f, h, j and k are 16-bit ports, port c is a 5-bit port, ports d is a 14-bit ports, and port g is a 4-bit port. all the port pins are multiplexed as general input/output pins and special function pins. the functions of the multiplex pins are selected by means of the pin function controller (pfc). each port is provided with a data register for storing the pin data.
662 19.2 port a port a is an input/output port with the 16 pins shown in figure 19.1. pa15 (i/o) /rxd0 (input) pa14 (i/o) /txd0 (output) pa13 (i/o) /tio5b (i/o) pa12 (i/o) /tio5a (i/o) pa11 (i/o) /tio4d (i/o) pa10 (i/o) /tio4c (i/o) pa9 (i/o) /tio4b (i/o) pa8 (i/o) /tio4a (i/o) pa7 (i/o) /tio3d (i/o) pa5 (i/o) /tio3b (i/o) pa4 (i/o) /tio3a (i/o) pa3 (i/o) /tiod (input) pa2 (i/o) /tioc (input) pa1 (i/o) /tiob (input) pa0 (i/o) /tioa (input) pa6 (i/o) /tio3c (i/o) port a figure 19.1 port a 19.2.1 register configuration the port a register configuration is shown in table 19.1. table 19.1 register configuration name abbreviation r/w initial value address access size port a data register padr r/w h'0000 h'fffff726 8, 16 note: a register access is performed in four or five cycles regardless of the access size.
663 19.2.2 port a data register (padr) bit: 15 14 13 12 11 10 9 8 pa15 dr pa14 dr pa13 dr pa12 dr pa11 dr pa10 dr pa9 dr pa8 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pa7 dr pa6 dr pa5 dr pa4 dr pa3 dr pa2 dr pa1 dr pa0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port a data register (padr) is a 16-bit readable/writable register that stores port a data. bits pa15dr to pa0dr correspond to pins pa15/rxd0 to pa0/ti0a. when a pin functions as a general output, if a value is written to padr, that value is output directly from the pin, and if padr is read, the register value is returned directly regardless of the pin state. when a pin functions as a general input, if padr is read the pin state, not the register value, is returned directly. if a value is written to padr, although that value is written into padr it does not affect the pin state. table 19.2 summarizes port a data register read/write operations. padr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. table 19.2 port a data register (padr) read/write operations bits 15 to 0: paior pin function read write 0 general input pin state value is written to padr, but does not affect pin state other than general input pin state value is written to padr, but does not affect pin state 1 general output padr value write value is output from pin other than general output padr value value is written to padr, but does not affect pin state
664 19.3 port b port b is an input/output port with the 16 pins shown in figure 19.2. pb15 (i/o) /puls5 (output) /sck2 (i/o) pb14 (i/o) /sck1 (i/o) /tclkb (input) /ti10 (input) pb13 (i/o) /sck0 (i/o) pb12 (i/o) /tclka (input) / ubctrg figure 19.2 port b 19.3.1 register configuration the port b register configuration is shown in table 19.3. table 19.3 register configuration name abbreviation r/w initial value address access size port b data register pbdr r/w h'0000 h'fffff738 8, 16 note: a register access is performed in four or five cycles regardless of the access size.
665 19.3.2 port b data register (pbdr) bit: 15 14 13 12 11 10 9 8 pb15 dr pb14 dr pb13 dr pb12 dr pb11 dr pb10 dr pb9 dr pb8 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pb7 dr pb6 dr pb5 dr pb4 dr pb3 dr pb2 dr pb1 dr pb0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port b data register (pbdr) is a 16-bit readable/writable register that stores port b data. bits pb15dr to pb0dr correspond to pins pb15/puls5/sck2 to pb0/to6a. when a pin functions as a general output, if a value is written to pbdr, that value is output directly from the pin, and if pbdr is read, the register value is returned directly regardless of the pin state. when a pin functions as a general input, if pbdr is read the pin state, not the register value, is returned directly. if a value is written to pbdr, although that value is written into pbdr it does not affect the pin state. table 19.4 summarizes port b data register read/write operations. pbdr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. table 19.4 port b data register (pbdr) read/write operations bits 15 to 0: pbior pin function read write 0 general input pin state value is written to pbdr, but does not affect pin state other than general input pin state value is written to pbdr, but does not affect pin state 1 general output pbdr value write value is output from pin other than general output pbdr value value is written to pbdr, but does not affect pin state
666 19.4 port c port c is an input/output port with the 5 pins shown in figure 19.3. pc4 (i/o) / irq0 figure 19.3 port c 19.4.1 register configuration the port c register configuration is shown in table 19.5. table 19.5 register configuration name abbreviation r/w initial value address access size port c data register pcdr r/w h'0000 h'fffff73e 8, 16 note: a register access is performed in four or five cycles regardless of the access size. 19.4.2 port c data register (pcdr) bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ? ? ? pc4 dr pc3 dr pc2 dr pc1 dr pc0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r r r r/w r/w r/w r/w r/w the port c data register (pcdr) is a 16-bit readable/writable register that stores port c data. bits pc4dr to pc0dr correspond to pins pc4/ irq0 to pc0/txd1.
667 when a pin functions as a general output, if a value is written to pcdr, that value is output directly from the pin, and if pcdr is read, the register value is returned directly regardless of the pin state. when a pin functions as a general input, if pcdr is read the pin state, not the register value, is returned directly. if a value is written to pcdr, although that value is written into pcdr it does not affect the pin state. table 19.6 summarizes port c data register read/write operations. pcdr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. ? bits 15 to 5?eserved: these bits always read 0. the write value should always be 0. table 19.6 port c data register (pcdr) read/write operations bits 4 to 0: pcior pin function read write 0 general input pin state value is written to pcdr, but does not affect pin state other than general input pin state value is written to pcdr, but does not affect pin state 1 general output pcdr value write value is output from pin other than general output pcdr value value is written to pcdr, but does not affect pin state
668 19.5 port d port d is an input/output port with the 14 pins shown in figure 19.4. pd13 (i/o) /puls6 (output) / htxd (output) pd12 (i/o) /puls4 (output) pd11 (i/o) /puls3 (output) pd10 (i/o) /puls2 (output) pd9 (i/o) /puls1 (output) pd8 (i/o) /puls0 (output) pd7 (i/o) /tio1h (i/o) pd6 (i/o) /tio1g (i/o) pd5 (i/o) /tio1f (i/o) pd3 (i/o) /tio1d (i/o) pd2 (i/o) /tio1c (i/o) pd1 (i/o) /tio1b (i/o) pd0 (i/o) /tio1a (i/o) pd4 (i/o) /tio1e (i/o) port d figure 19.4 port d 19.5.1 register configuration the port d register configuration is shown in table 19.7. table 19.7 register configuration name abbreviation r/w initial value address access size port d data register pddr r/w h'0000 h'fffff746 8, 16 note: a register access is performed in four or five cycles regardless of the access size.
669 19.5.2 port d data register (pddr) bit: 15 14 13 12 11 10 9 8 ?? pd13 dr pd12 dr pd11 dr pd10 dr pd9 dr pd8 dr initial value: 0 0 0 0 0 0 0 0 r/w: r r r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pd7 dr pd6 dr pd5 dr pd4 dr pd3 dr pd2 dr pd1 dr pd0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port d data register (pddr) is a 16-bit readable/writable register that stores port d data. bits pd13dr to pd0dr correspond to pins pd13/puls6/htxd0/htxd1 to pd0/tio1a. when a pin functions as a general output, if a value is written to pddr, that value is output directly from the pin, and if pddr is read, the register value is returned directly regardless of the pin state. when a pin functions as a general input, if pddr is read the pin state, not the register value, is returned directly. if a value is written to pddr, although that value is written into pddr it does not affect the pin state. table 19.8 summarizes port d data register read/write operations. pddr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. ? bits 15 and 14?reserved: these bits always read 0. the write value should always be 0. table 19.8 port d data register (pddr) read/write operations bits 13 to 0: pdior pin function read write 0 general input pin state value is written to pddr, but does not affect pin state other than general input pin state value is written to pddr, but does not affect pin state 1 general output pddr value write value is output from pin other than general output pddr value value is written to pddr, but does not affect pin state
670 19.6 port e port e is an input/output port with the 16 pins shown in figure 19.5. a15 (output) a14 (output) a13 (output) a12 (output) a11 (output) a10 (output) a9 (output) a8 (output) a7 (output) a5 (output) a4 (output) a3 (output) a2 (output) a1 (output) a0 (output) a6 (output) port e pe15 (i/o) /a15 (output) pe14 (i/o) /a14 (output) pe13 (i/o) /a13 (output) pe12 (i/o) /a12 (output) pe11 (i/o) /a11 (output) pe10 (i/o) /a10 (output) pe9 (i/o) /a9 (output) pe8 (i/o) /a8 (output) pe7 (i/o) /a7 (output) pe5 (i/o) /a5 (output) pe4 (i/o) /a4 (output) pe3 (i/o) /a3 (output) pe2 (i/o) /a2 (output) pe1 (i/o) /a1 (output) pe0 (i/o) /a0 (output) pe6 (i/o) /a6 (output) pe15 (i/o) rom disabled expansion mode rom enabled expansion mode single- chip mode pe14 (i/o) pe13 (i/o) pe12 (i/o) pe11 (i/o) pe10 (i/o) pe9 (i/o) pe8 (i/o) pe7 (i/o) pe5 (i/o) pe4 (i/o) pe3 (i/o) pe2 (i/o) pe1 (i/o) pe0 (i/o) pe6 (i/o) figure 19.5 port e 19.6.1 register configuration the port e register configuration is shown in table 19.9. table 19.9 register configuration name abbreviation r/w initial value address access size port e data register pedr r/w h'0000 h'fffff754 8, 16 note: a register access is performed in four or five cycles regardless of the access size.
671 19.6.2 port e data register (pedr) bit: 15 14 13 12 11 10 9 8 pe15 dr pe14 dr pe13 dr pe12 dr pe11 dr pe10 dr pe9 dr pe8 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pe7 dr pe6 dr pe5 dr pe4 dr pe3 dr pe2 dr pe1 dr pe0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port e data register (pedr) is a 16-bit readable/writable register that stores port e data. bits pe15dr to pe0dr correspond to pins pe15/a15 to pe0/a0. when a pin functions as a general output, if a value is written to pedr, that value is output directly from the pin, and if pedr is read, the register value is returned directly regardless of the pin state. when the pod pin is driven low, general outputs go to the high-impedance state regardless of the pedr value. when the pod pin is driven high, the written value is output from the pin. when a pin functions as a general input, if pedr is read the pin state, not the register value, is returned directly. if a value is written to pedr, although that value is written into pedr it does not affect the pin state. table 19.10 summarizes port e data register read/write operations. pedr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
672 table 19.10 port e data register (pedr) read/write operations bits 15 to 0: peior pin function read write 0 general input pin state value is written to pedr, but does not affect pin state other than general input pin state value is written to pedr, but does not affect pin state 1 general output pedr value write value is output from pin ( pod pin = high) high impedance regardless of pedr value ( pod pin = low) other than general output pedr value value is written to pedr, but does not affect pin state
673 19.7 port f port f is an input/output port with the 16 pins shown in figure 19.6. pf15 (i/o) pf14 (i/o) pf13 (i/o) pf12 (i/o) pf11 (i/o) pf10 (i/o) pf9 (i/o) pf8 (i/o) pf7 (i/o) a21 (output) a20 (output) a19 (output) a18 (output) a17 (output) pf6 (i/o) port f breq (input) back (output) cs3 (output) cs2 (output) cs1 (output) cs0 (output) rd (output) wait (input) wrh (output) pf5 (i/o) /a21 (output) / pod (input) pf4 (i/o) /a20 (output) pf3 (i/o) /a19 (output) pf2 (i/o) /a18 (output) pf1 (i/o) /a17 (output) wrl (output) pf15 (i/o) rom disabled expansion mode rom enabled expansion mode single- chip mode pf14 (i/o) pf13 (i/o) pf12 (i/o) pf11 (i/o) pf10 (i/o) pf9 (i/o) pf8 (i/o) pf7 (i/o) pf5 (i/o) / pod (input) pf4 (i/o) pf3 (i/o) pf2 (i/o) pf1 (i/o) a16 (output) pf0 (i/o) /a16 (output) pf0 (i/o) pf6 (i/o) figure 19.6 port f 19.7.1 register configuration the port f register configuration is shown in table 19.11. table 19.11 register configuration name abbreviation r/w initial value address access size port f data register pfdr r/w h'0000 h'fffff74e 8, 16 note: a register access is performed in four or five cycles regardless of the access size.
674 19.7.2 port f data register (pfdr) bit: 15 14 13 12 11 10 9 8 pf15 dr pf14 dr pf13 dr pf12 dr pf11 dr pf10 dr pf9 dr pf8 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pf7 dr pf6 dr pf5 dr pf4 dr pf3 dr pf2 dr pf1 dr pf0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port f data register (pfdr) is a 16-bit readable/writable register that stores port f data. bits pf15dr to pf0dr correspond to pins pf15/ breq to pf0/a16. when a pin functions as a general output, if a value is written to pfdr, that value is output directly from the pin, and if pfdr is read, the register value is returned directly regardless of the pin state. for pins pf0 to pf4, when the pod pin is driven low, general outputs go to the high- impedance state regardless of the pfdr value. when the pod pin is driven high, the written value is output from the pin. when a pin functions as a general input, if pfdr is read the pin state, not the register value, is returned directly. if a value is written to pfdr, although that value is written into pfdr it does not affect the pin state. table 19.12 summarizes port f data register read/write operations. pfdr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
675 table 19.12 port f data register (pfdr) read/write operations bits 15 to 5: pfior pin function read write 0 general input pin state value is written to pfdr, but does not affect pin state other than general input pin state value is written to pfdr, but does not affect pin state 1 general output pfdr value write value is output from pin other than general output pfdr value value is written to pfdr, but does not affect pin state bits 4 to 0: pfior pin function read write 0 general input pin state value is written to pfdr, but does not affect pin state other than general input pin state value is written to pfdr, but does not affect pin state 1 general output pfdr value write value is output from pin ( pod pin = high) high impedance regardless of pfdr value ( pod pin = low) other than general output pfdr value value is written to pfdr, but does not affect pin state
676 19.8 port g port g is an input/output port with the 4 pins shown in figure 19.7. pg3 (i/o) / irq3 (input) / adtrg0 (input) pg2 (i/o) / irq2 (input) pg1 (i/o) / irq1 (input) pg0 (i/o) /puls7 (output) /hrxd (input) port g figure 19.7 port g 19.8.1 register configuration the port g register configuration is shown in table 19.13. table 19.13 register configuration name abbreviation r/w initial value address access size port g data register pgdr r/w h'0000 h'fffff764 8, 16 note: a register access is performed in four or five cycles regardless of the access size. 19.8.2 port g data register (pgdr) bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ???? pg3 dr pg2 dr pg1 dr pg0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w the port g data register (pgdr) is a 16-bit readable/writable register that stores port g data. bits pg3dr to pg0dr correspond to pins pg3/ irq3 / adtrg0 to pg0/puls7/hrxd0.
677 when a pin functions as a general output, if a value is written to pgdr, that value is output directly from the pin, and if pgdr is read, the register value is returned directly regardless of the pin state. when a pin functions as a general input, if pgdr is read the pin state, not the register value, is returned directly. if a value is written to pgdr, although that value is written into pgdr it does not affect the pin state. table 19.14 summarizes port g data register read/write operations. pgdr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. ? bits 15 to 4?eserved: these bits always read 0. the write value should always be 0. table 19.14 port g data register (pgdr) read/write operations bits 3 to 0: pgior pin function read write 0 general input pin state value is written to pgdr, but does not affect pin state other than general input pin state value is written to pgdr, but does not affect pin state 1 general output pgdr value write value is output from pin other than general output pgdr value value is written to pgdr, but does not affect pin state
678 19.9 port h port h is an input/output port with the 16 pins shown in figure 19.8. ph15 (i/o) / d15 (i/o) ph14 (i/o) / d14 (i/o) ph13 (i/o) / d13 (i/o) ph12 (i/o) / d12 (i/o) ph11 (i/o) / d11 (i/o) ph10 (i/o) / d10 (i/o) ph9 (i/o) / d9 (i/o) ph8 (i/o) / d8 (i/o) d7 (i/o) d5 (i/o) d4 (i/o) d3 (i/o) d2 (i/o) d1 (i/o) d6 (i/o) d15 (i/o) d14 (i/o) d13 (i/o) d12 (i/o) d11 (i/o) d10 (i/o) d9 (i/o) d8 (i/o) port h ph15 (i/o) (area 0: 8 bits) rom disabled expansion mode (area 0: 16 bits) single- chip mode ph14 (i/o) ph13 (i/o) ph12 (i/o) ph11 (i/o) ph10 (i/o) ph9 (i/o) ph8 (i/o) ph7 (i/o) ph5 (i/o) ph4 (i/o) ph3 (i/o) ph2 (i/o) ph1 (i/o) d0 (i/o) ph0 (i/o) ph6 (i/o) ph15 (i/o) / d15 (i/o) rom enabled expansion mode ph14 (i/o) / d14 (i/o) ph13 (i/o) / d13 (i/o) ph12 (i/o) / d12 (i/o) ph11 (i/o) / d11 (i/o) ph10 (i/o) / d10 (i/o) ph9 (i/o) / d9 (i/o) ph8 (i/o) / d8 (i/o) ph7 (i/o) / d7 (i/o) ph5 (i/o) / d5 (i/o) ph4 (i/o) / d4 (i/o) ph3 (i/o) / d3 (i/o) ph2 (i/o) / d2 (i/o) ph1 (i/o) / d1 (i/o) ph0 (i/o) / d0 (i/o) ph6 (i/o) / d6 (i/o) figure 19.8 port h
679 19.9.1 register configuration the port h register configuration is shown in table 19.15. table 19.15 register configuration name abbreviation r/w initial value address access size port h data register phdr r/w h'0000 h'fffff72c 8, 16 note: a register access is performed in four or five cycles regardless of the access size. 19.9.2 port h data register (phdr) bit: 15 14 13 12 11 10 9 8 ph15 dr ph14 dr ph13 dr ph12 dr ph11 dr ph10 dr ph9 dr ph8 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 ph7 dr ph6 dr ph5 dr ph4 dr ph3 dr ph2 dr ph1 dr ph0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port h data register (phdr) is a 16-bit readable/writable register that stores port h data. bits ph15dr to ph0dr correspond to pins ph15/d15 to ph0/d0. when a pin functions as a general output, if a value is written to phdr, that value is output directly from the pin, and if phdr is read, the register value is returned directly regardless of the pin state. when the pod pin is driven low, general outputs go to the high-impedance state regardless of the phdr value. when the pod pin is driven high, the written value is output from the pin. when a pin functions as a general input, if phdr is read the pin state, not the register value, is returned directly. if a value is written to phdr, although that value is written into phdr it does not affect the pin state. table 19.16 summarizes port h data register read/write operations. phdr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode.
680 table 19.16 port h data register (phdr) read/write operations bits 15 to 0: phior pin function read write 0 general input pin state value is written to phdr, but does not affect pin state other than general input pin state value is written to phdr, but does not affect pin state 1 general output phdr value write value is output from pin ( pod pin = high) high impedance regardless of phdr value ( pod pin = low) other than general output phdr value value is written to phdr, but does not affect pin state
681 19.10 port j port j is an input/output port with the 16 pins shown in figure 19.9. pj15 (i/o) /ti9f (input) pj14 (i/o) /ti9e (input) pj13 (i/o) /ti9d (input) pj12 (i/o) /ti9c (input) pj11 (i/o) /ti9b (input) pj10 (i/o) /ti9a (input) pj9 (i/o) /tio5d (i/o) pj8 (i/o) /tio5c (i/o) pj7 (i/o) /tio2h (i/o) pj5 (i/o) /tio2f (i/o) pj4 (i/o) /tio2e (i/o) pj3 (i/o) /tio2d (i/o) pj2 (i/o) /tio2c (i/o) pj1 (i/o) /tio2b (i/o) pj0 (i/o) /tio2a (i/o) pj6 (i/o) /tio2g (i/o) port j figure 19.9 port j 19.10.1 register configuration the port j register configuration is shown in table 19.17. table 19.17 register configuration name abbreviation r/w initial value address access size port j data register pjdr r/w h'0000 h'fffff76c 8, 16 note: a register access is performed in four or five cycles regardless of the access size.
682 19.10.2 port j data register (pjdr) bit: 15 14 13 12 11 10 9 8 pj15 dr pj14 dr pj13 dr pj12 dr pj11 dr pj10 dr pj9 dr pj8 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pj7 dr pj6 dr pj5 dr pj4 dr pj3 dr pj2 dr pj1 dr pj0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port j data register (pjdr) is a 16-bit readable/writable register that stores port j data. bits pj15dr to pj0dr correspond to pins pj15/ti9f to pj0/tio2a. when a pin functions as a general output, if a value is written to pjdr, that value is output directly from the pin, and if pjdr is read, the register value is returned directly regardless of the pin state. when a pin functions as a general input, if pjdr is read the pin state, not the register value, is returned directly. if a value is written to pjdr, although that value is written into pjdr it does not affect the pin state. table 19.18 summarizes port j data register read/write operations. pjdr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. table 19.18 port j data register (pjdr) read/write operations bits 15 to 0: pjior pin function read write 0 general input pin state value is written to pjdr, but does not affect pin state other than general input pin state value is written to pjdr, but does not affect pin state 1 general output pjdr value write value is output from pin other than general output pjdr value value is written to pjdr, but does not affect pin state
683 19.11 port k port k is an input/output port with the 16 pins shown in figure 19.10. pk15 (i/o) /to8p (output) pk14 (i/o) /to8o (output) pk13 (i/o) /to8n (output) pk12 (i/o) /to8m (output) pk11 (i/o) /to8l (output) pk10 (i/o) /to8k (output) pk9 (i/o) /to8j (output) pk8 (i/o) /to8i (output) pk7 (i/o) /to8h (output) pk5 (i/o) /to8f (output) pk4 (i/o) /to8e (output) pk3 (i/o) /to8d (output) pk2 (i/o) /to8c (output) pk1 (i/o) /to8b (output) pk0 (i/o) /to8a (output) pk6 (i/o) /to8g (output) port k figure 19.10 port k 19.11.1 register configuration the port k register configuration is shown in table 19.19. table 19.19 register configuration name abbreviation r/w initial value address access size port k data register pkdr r/w h'0000 h'fffff778 8, 16 note: a register access is performed in four or five cycles regardless of the access size.
684 19.11.2 port k data register (pkdr) bit: 15 14 13 12 11 10 9 8 pk15 dr pk14 dr pk13 dr pk12 dr pk11 dr pk10 dr pk9 dr pk8 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w bit: 7 6 5 4 3 2 1 0 pk7 dr pk6 dr pk5 dr pk4 dr pk3 dr pk2 dr pk1 dr pk0 dr initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w the port k data register (pkdr) is a 16-bit readable/writable register that stores port k data. bits pk15dr to pk0dr correspond to pins pk15/to8p to pk0/to8a. when a pin functions as a general output, if a value is written to pkdr, that value is output directly from the pin, and if pkdr is read, the register value is returned directly regardless of the pin state. when a pin functions as a general input, if pkdr is read the pin state, not the register value, is returned directly. if a value is written to pkdr, although that value is written into pkdr it does not affect the pin state. table 19.20 summarizes port k data register read/write operations. pkdr is initialized to h'0000 by a power-on reset (excluding a wdt power-on reset), and in hardware standby mode. it is not initialized in software standby mode or sleep mode. table 19.20 port k data register (pkdr) read/write operations bits 15 to 0: pkior pin function read write 0 general input pin state value is written to pkdr, but does not affect pin state other than general input pin state value is written to pkdr, but does not affect pin state 1 general output pkdr value write value is output from pin other than general output pkdr value value is written to pkdr, but does not affect pin state
685 19.12 pod (port output disable) control the output port drive buffers for the address bus pins (a20 to a0) and data bus pins (d15 to d0) can be controlled by the pod (port output disable) pin input level. however, this function is enabled only when the address bus pins (a20 to a0) and data bus pins (d15 to d0) are designated as general output ports. output buffer control by means of pod is performed asynchronously from bus cycles. pod address bus pins (a20 to a0) and data bus pins (d15 to d0) (when designated as output ports) 0 enabled (high-impedance) 1 disabled (general output)
686
687 section 20 rom (sh7052f/sh7053f) 20.1 features the sh7052f/sh7053f has 256 kbytes of on-chip flash memory. the features of the flash memory are summarized below. ? four flash memory operating modes ? program mode ? erase mode ? program-verify mode ? erase-verify mode ? programming/erase methods the flash memory is programmed 128 bytes at a time. block erase (in single-block units) can be performed. to erase the entire flash memory, individual blocks must be erased in turn. block erasing can be performed as required on 4 kb, 32 kb, and 64 kb blocks. ? programming/erase times the flash memory programming time is 7 ms (typ.) for simultaneous 128-byte programming, equivalent to 55 ? (typ.) per byte, and the erase time is 100 ms (typ.) per block. ? reprogramming capability the flash memory can be reprogrammed up to 100 times. ? on-board programming modes there are two modes in which flash memory can be programmed/erased/verified on-board: ? boot mode ? user program mode ? automatic bit rate adjustment with data transfer in boot mode, the sh7052f/sh7053f? bit rate can be automatically adjusted to match the transfer bit rate of the host. ? flash memory emulation in ram flash memory programming can be emulated in real time by overlapping a part of ram onto flash memory. ? protect modes there are two protect modes, hardware and software, which allow protected status to be designated for flash memory program/erase/verify operations. ? programmer mode flash memory can be programmed/erased in programmer mode, using a prom programmer, as well as in on-board programming mode.
688 20.2 overview 20.2.1 block diagram module bus bus interface/controller flash memory (256 kb) operating mode flmcr2 internal address bus internal data bus (32 bits) fwe pin mode pin ebr1 ebr2 ramer flmcr1 flash memory control register 1 flash memory control register 2 erase block register 1 erase block register 2 ram emulation register legend flmcr1: flmcr2: ebr1: ebr2: ramer: figure 20.1 block diagram of flash memory
689 20.2.2 mode transitions when the mode pins and the fwe pin are set in the reset state and a reset-start is executed, the microcomputer enters an operating mode as shown in figure 20.2. in user mode, flash memory can be read but not programmed or erased. the boot, user program and programmer modes are provided as modes to write and erase the flash memory. boot mode on-board programming mode user program mode user mode reset state programmer mode res * 1 * 1 * 2 notes: only make a transition between user mode and user program mode when the cpu is not accessing the flash memory. 1. ram emulation possible 2. md0 = 1, md1 = 1, md2 = 0 res res res figure 20.2 flash memory state transitions
690 20.2.3 on-board programming modes boot mode flash memory sh7052f, sh7053f ram host programming control program sci application program (old version) new application program flash memory sh7052f, sh7053f ram host sci application program (old version) boot program area new application program flash memory sh7052f, sh7053f ram host sci flash memory preprogramming erase boot program new application program flash memory sh7052f, sh7053f program execution state ram host sci new application program boot program programming control program 1. initial state the old program version or data remains written in the flash memory. the user should prepare the programming control program and new application program beforehand in the host. 2. programming control program transfer when boot mode is entered, the boot program in the sh7052f, sh7053f (originally incorporated in the chip) is started and the programming control program in the host is transferred to ram via sci communication. the boot program required for flash memory erasing is automatically transferred to the ram boot program area. 3. flash memory initialization the erase program in the boot program area (in ram) is executed, and the flash memory is initialized (to h'ff). in boot mode, total flash memory erasure is performed, without regard to blocks. 4. writing new application program the programming control program transferred from the host to ram is executed, and the new application program in the host is written into the flash memory. programming control program boot program boot program boot program area boot program area programming control program figure 20.3 boot mode
691 user program mode flash memory sh7052f, sh7053f ram host programming/ erase control program sci boot program new application program flash memory sh7052f, sh7053f ram host sci new application program flash memory sh7052f, sh7053f ram host sci flash memory erase boot program new application program flash memory sh7052f, sh7053f program execution state ram host sci boot program boot program fwe assessment program application program (old version) new application program 1. initial state the fwe assessment program that confirms that user program mode has been entered, and the program that will transfer the programming/erase control program from flash memory to on-chip ram should be written into the flash memory by the user beforehand. the programming/erase control program should be prepared in the host or in the flash memory. 2. programming/erase control program transfer when user program mode is entered, user software confirms this fact, executes transfer program in the flash memory, and transfers the programming/erase control program to ram. 3. flash memory initialization the programming/erase program in ram is executed, and the flash memory is initialized (to h'ff). erasing can be performed in block units, but not in byte units. 4. writing new application program next, the new application program in the host is written into the erased flash memory blocks. do not write to unerased blocks. programming/ erase control program programming/ erase control program programming/ erase control program transfer program application program (old version) transfer program fwe assessment program fwe assessment program transfer program fwe assessment program transfer program figure 20.4 user program mode
692 20.2.4 flash memory emulation in ram emulation should be performed in user mode or user program mode. when the emulation block set in ramer is accessed while the emulation function is being executed, data written in the overlap ram is read. user mode ? user program mode application program execution state flash memory emulation block ram sci overlap ram (emulation is performed on data written in ram) figure 20.5 emulation when overlap ram data is confirmed, the rams bit is cleared, ram overlap is released, and writes should actually be performed to the flash memory. when the programming control program is transferred to ram, ensure that the transfer destination and the overlap ram do not overlap, as this will cause data in the overlap ram to be rewritten.
693 ? user program mode application program flash memory ram sci programming control program execution state overlap ram (programming data) programming data figure 20.6 programming flash memory 20.2.5 differences between boot mode and user program mode table 20.1 differences between boot mode and user mode boot mode user program mode total erase yes yes block erase no yes programming control program * (2) (1) (2) (3) (1) erase/erase-verify (2) program/program-verify (3) emulation note: * to be provided by the user, in accordance with the recommended algorithm.
694 20.2.6 block configuration the flash memory is divided into three 64 kb blocks, one 32 kb block, and eight 4 kb blocks. address h'3ffff address h'00000 64 kb 64 kb 64 kb 32 kb 256 kb 4 kb figure 20.7 block configuration 20.3 pin configuration the flash memory is controlled by means of the pins shown in table 20.2. table 20.2 pin configuration pin name abbreviation i/o function reset res
695 20.4 register configuration the registers used to control the on-chip flash memory when enabled are shown in table 20.3. table 20.3 register configuration register name abbreviation r/w initial value address access size flash memory control register 1 flmcr1 r/w * 1 h'00 * 2 h'ffffe800 8 flash memory control register 2 flmcr2 r/w * 1 h'00 h'ffffe801 8 erase block register 1 ebr1 r/w * 1 h'00 * 3 h'ffffe802 8 erase block register 2 ebr2 r/w * 1 h'00 * 4 h'ffffe803 8 ram emulation register ramer r/w h'0000 h'ffffec26 8, 16, 32 notes: 1. in modes in which the on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes are also disabled when the fwe bit is set to 1 in flmcr1. 2. when a high level is input to the fwe pin, the initial value is h'80. 3. when a low level is input to the fwe pin, or if a high level is input and the swe1 bit in flmcr1 is not set, these registers are initialized to h'00. 4. will be initialized to h'00 if a low level is input to pin fwe or if bit swe2 of flmcr2 is not set even though a high level is input. 5. flmcr1, flmcr2, ebr1, and ebr2 are 8-bit registers, and ramer is a 16-bit register. 6. only byte accesses are valid for flmcr1, flmcr2, ebr1, and ebr2, the access requiring 3 cycles. three cycles are required for a byte or word access to ramer, and 6 cycles for a longword access.
696 20.5 register descriptions 20.5.1 flash memory control register 1 (flmcr1) flmcr1 is an 8-bit register used for flash memory operating mode control. program-verify mode or erase-verify mode is entered by setting swe1 bit to 1 when fwe = 1, then setting the ev1 or pv1 bit. program mode is entered by setting swe1 bit to 1 when fwe = 1, then setting the psu1 bit, and finally setting the p1 bit. erase mode for addresses h'00000 to h'3ffff is entered by setting swe1 bit to 1 when fwe = 1, then setting the esu1 bit, and finally setting the e1 bit. flmcr1 is initialized by a power-on reset, and in hardware standby mode and software standby mode. its initial value is h'80 when a high level is input to the fwe pin, and h'00 when a low level is input. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes are enabled only in the following cases: writes to bit swe1 of flmcr1 enabled when fwe = 1, to bits esu1, psu1, ev1, and pv1 when fwe = 1 and swe1 = 1, to bit e1 when fwe = 1, swe1 = 1 and esu1 = 1, and to bit p1 when fwe = 1, swe1 = 1, and psu1 = 1. bit: 7 6 5 4 3 2 1 0 fwe swe1 esu1 psu1 ev1 pv1 e1 p1 initial value: 1/0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w ? bit 7 flash write enable bit (fwe): sets hardware protection against flash memory programming/erasing. bit 7: fwe description 0 when a low level is input to the fwe pin (hardware-protected state) 1 when a high level is input to the fwe pin ? bit 6 software write enable bit 1 (swe1): enables or disables flash memory programming and erasing. set this bit when setting bits 5 to 0, bits 7 to 0 of ebr1, and bits 3 to 0 of ebr2. bit 6: swe1 description 0 writes disabled (initial value) 1 writes enabled [setting condition] when fwe = 1
697 ? bit 5 erase setup bit 1 (esu1): prepares for a transition to erase mode. do not set the swe1, psu1, ev1, pv1, e1, or p1 bit at the same time. bit 5: esu1 description 0 erase setup cleared (initial value) 1 erase setup [setting condition] when fwe = 1 and swe1 = 1 ? bit 4 program setup bit 1 (psu1): prepares for a transition to program mode. do not set the swe1, esu1, ev1, pv1, e1, or p1 bit at the same time. bit 4: psu1 description 0 program setup cleared (initial value) 1 program setup [setting condition] when fwe = 1 and swe1 = 1 ? bit 3 erase-verify 1 (ev1): selects erase-verify mode transition or clearing. do not set the swe1, esu1, psu1, pv1, e1, or p1 bit at the same time. bit 3: ev1 description 0 erase-verify mode cleared (initial value) 1 transition to erase-verify mode [setting condition] when fwe = 1 and swe1 = 1 ? bit 2 program-verify 1 (pv1): selects program-verify mode transition or clearing. do not set the swe1, esu1, psu1, ev1, e1, or p1 bit at the same time. bit 2: pv1 description 0 program-verify mode cleared (initial value) 1 transition to program-verify mode [setting condition] when fwe = 1 and swe1 = 1
698 ? bit 1 erase 1 (e1): selects erase mode transition or clearing. do not set the swe1, esu1, psu1, ev1, pv1, or p1 bit at the same time. bit 1: e1 description 0 erase mode cleared (initial value) 1 transition to erase mode [setting condition] when fwe = 1, swe1 = 1, and esu1 = 1 ? bit 0 program 1 (p1): selects program mode transition or clearing. do not set the swe1, psu1, esu1, ev1, pv1, or e1 bit at the same time. bit 0: p1 description 0 program mode cleared (initial value) 1 transition to program mode [setting condition] when fwe = 1, swe1 = 1, and psu1 = 1 20.5.2 flash memory control register 2 (flmcr2) flmcr2 is a status register that indicates the occurrence of an error during flash memory programming or erasing. flmcr2 is initialized to h 00 by a power-on reset and in hardware standby mode. when on-chip flash memory is disabled, a read will return h 00 and writes are invalid. bit: 7 6 5 4 3 2 1 0 fler ?? ?? ? ??
699 ? bit 7 flash memory error (fler): indicates that an error has occurred during an operation on flash memory (programming or erasing). when fler is set to 1, flash memory goes to the error-protection state. bit 7: fler description 0 flash memory is operating normally (initial value) flash memory program/erase protection (error protection) is disabled [clearing condition] power-on reset or hardware standby mode 1 an error has occurred during flash memory programming/erasing flash memory program/erase protection (error protection) is enabled [setting condition] see 20.8.3 error protection ? bits 6 to 0 reserved: these bits always read 0. the write value should always be 0. 20.5.3 erase block register 1 (ebr1) ebr1 is an 8-bit register that specifies the flash memory erase area block by block. ebr1 is initialized to h'00 by a power-on reset, in hardware standby mode and software standby mode, when a low level is input to the fwe pin, and when a high level is input to the fwe pin and the swe1 bit in flmcr1 is not set. when a bit in ebr1 is set to 1, the corresponding block can be erased. other blocks are erase-protected. only one of the bits of ebr1 and ebr2 combined can be set. do not set more than one bit. (do not set more than one bit, as this will automatically clear both ebr1 and ebr2 to 0.) when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. the flash memory block configuration is shown in table 20.4. bit: 7 6 5 4 3 2 1 0 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 20.5.4 erase block register 2 (ebr2) ebr2 is an 8-bit register that specifies the flash memory erase area block by block. ebr2 is initialized to h'00 by a power-on reset, in hardware standby mode and software standby mode, when a low level is input to the fwe pin. bits 3 to 0 will be initialized to 0 if bit swe1 is not set, even though a high level is input to pin fwe. when a bit in ebr2 is set to 1, the corresponding
700 block can be erased. other blocks are erase-protected. only one of the bits of ebr1 and ebr2 combined can be set. do not set more than one bit. (do not set more than one bit, as this will automatically clear both ebr1 and ebr2 to 0.) when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. the flash memory block configuration is shown in table 20.5. bit: 7 6 5 4 3 2 1 0 ???? table 20.4 flash memory erase blocks block (size) addresses eb0 (4 kb) h'000000 to h'000fff eb1 (4 kb) h'001000 to h'001fff eb2 (4 kb) h'002000 to h'002fff eb3 (4 kb) h'003000 to h'003fff eb4 (4 kb) h'004000 to h'004fff eb5 (4 kb) h'005000 to h'005fff eb6 (4 kb) h'006000 to h'006fff eb7 (4 kb) h'007000 to h'007fff eb8 (32 kb) h'008000 to h'00ffff eb9 (64 kb) h'010000 to h'01ffff eb10 (64 kb) h'020000 to h'02ffff eb11 (64 kb) h'030000 to h'03ffff
701 20.5.5 ram emulation register (ramer) ramer specifies the area of flash memory to be overlapped with part of ram when emulating real-time flash memory programming. ramer is initialized to h'0000 by a power-on reset and in hardware standby mode. it is not initialized in software standby mode. ramer settings should be made in user mode or user program mode. flash memory area divisions are shown in table 20.5. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed immediately after this register has been modified. normal execution of an access immediately after register modification is not guaranteed. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ? ? ? ? rams ram2 ram1 ram0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w ? bits 15 to 4 reserved: these bits always read 0. the write value should always be 0. ? bit 3 ram select (rams): specifies selection or non-selection of flash memory emulation in ram. when rams = 1, all flash memory block are program/erase-protected. bit 3: rams description 0 emulation not selected (initial value) program/erase-protection of all flash memory blocks is disabled 1 emulation selected program/erase-protection of all flash memory blocks is enabled
702 ? bits 2 to 0 flash memory area selection (ram2, ram1, ram0): these bits are used together with bit 3 to select the flash memory area to be overlapped with ram. (see table 22.5.) table 20.5 flash memory area divisions addresses block name rams ram1 ram1 ram0 h'ffff8000 to h'ffff8fff ram area 4 kb 0 ** * h'00000000 to h'00000fff eb0 (4 kb) 1 0 0 0 h'00001000 to h'00001fff eb1 (4 kb) 1 0 0 1 h'00002000 to h'00002fff eb2 (4 kb) 1 0 1 0 h'00003000 to h'00003fff eb3 (4 kb) 1 0 1 1 h'00004000 to h'00004fff eb4 (4 kb) 1 1 0 0 h'00005000 to h'00005fff eb5 (4 kb) 1 1 0 1 h'00006000 to h'00006fff eb6 (4 kb) 1 1 1 0 h'00007000 to h'00007fff eb7 (4 kb) 1 1 1 1 * : don't care
703 20.6 on-board programming modes when pins are set to on-board programming mode and a reset-start is executed, a transition is made to the on-board programming state in which program/erase/verify operations can be performed on the on-chip flash memory. there are two on-board programming modes: boot mode and user program mode. the pin settings for transition to each of these modes are shown in table 20.6. for a diagram of the transitions to the various flash memory modes, see figure 20.2. table 20.6 setting on-board programming modes mode pll multiple fwe md2 md1 md0 boot mode expanded mode 20.6.1 boot mode when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. the sci channel to be used is set to asynchronous mode. when a reset-start is executed after the sh7052f/sh7053f s pins have been set to boot mode, the boot program built into the sh7052f/sh7053f is started and the programming control program prepared in the host is serially transmitted to the sh7052f/sh7053f via the sci. in the sh7052f/sh7053f, the programming control program received via the sci is written into the programming control program area in on-chip ram. after the transfer is completed, control branches to the start address of the programming control program area and the programming control program execution state is entered (flash memory programming is performed). the transferred programming control program must therefore include coding that follows the programming algorithm given later. the system configuration in boot mode is shown in figure 20.8, and the boot mode execution procedure in figure 20.9.
704 rxd1 txd1 sci1 sh7052f, sh7053f flash memory write data reception verify data transmission host on-chip ram figure 20.8 system configuration in boot mode
705 note: if a memory cell does not operate normally and cannot be erased, one h'ff byte is transmitted as an erase error, and the erase operation and subsequent operations are halted. start set pins to boot mode and execute reset-start host transfers data (h'00) continuously at prescribed bit rate sh7052f and sh7053f measure low period of h'00 data transmitted by host sh7052f and sh7053f calculate bit rate and sets value in bit rate register after bit rate adjustment, sh7052f and sh7053f transmit one h'00 data byte to host to indicate end of adjustment host confirms normal reception of bit rate adjustment end indication (h'00), and transmits one h'55 data byte after receiving h'55, sh7052f and sh7053f transmit one h'aa data byte to host host transmits number of programming control program bytes (n), upper byte followed by lower byte sh7052f and sh7053f transmit received number of bytes to host as verify data (echo-back) n = 1 host transmits programming control program sequentially in byte units sh7052f and sh7053f transmit received programming control program to host as verify data (echo-back) transfer received programming control program to on-chip ram n = n? no yes end of transmission check flash memory data, and if data has already been written, erase all blocks after confirming that all flash memory data has been erased, sh7052f and sh7053f transmit one h'aa data byte to host execute programming control program transferred to on-chip ram n + 1 figure 20.9 boot mode execution procedure
706 automatic sci bit rate adjustment start bit stop bit d0 d1 d2 d3 d4 d5 d6 d7 low period (9 bits) measured (h'00 data) high period (1 or more bits) figure 20.10 automatic sci bit rate ajustment when boot mode is initiated, the sh7052f/sh7053f measures the low period of the asynchronous sci communication data (h'00) transmitted continuously from the host. the sci transmit/receive format should be set as follows: 8-bit data, 1 stop bit, no parity. the sh7052f/sh7053f calculates the bit rate of the transmission from the host from the measured low period, and transmits one h'00 byte to the host to indicate the end of bit rate adjustment. the host should confirm that this adjustment end indication (h'00) has been received normally, and transmit one h'55 byte to the sh7052f/sh7053f. if reception cannot be performed normally, initiate boot mode again (reset), and repeat the above operations. depending on the host s transmission bit rate and the sh7052f/sh7053f s system clock frequency, there will be a discrepancy between the bit rates of the host and the sh7052f/sh7053f. set the host transfer bit rate at 9,600 or 19,200 bps to operate the sci properly. table 20.7 shows host transfer bit rates and system clock frequencies for which automatic adjustment of the sh7052f/sh7053f bit rate is possible. the boot program should be executed within this system clock range. table 20.7 system clock frequencies for which automatic adjustment of sh7052f/sh7053f bit rate is possible host bit rate system clock frequency for which automatic adjustment of sh7052f/sh7053f bit rate is possible 9,600 bps 20 to 40 mhz (input frequency: 5 to 10 mhz) 19,200 bps 20 to 40 mhz (input frequency: 5 to 10 mhz)
707 on-chip ram area divisions in boot mode: in boot mode, the ram area is divided into an area used by the boot program and an area to which the programming control program is transferred via the sci, as shown in figure 20.11. the boot program area cannot be used until the execution state in boot mode switches to the programming control program transferred from the host. h'ffff8000 h'ffff87ff h'ffffafff boot program area ( 2 kbytes) programming control program area (10 kbytes) h'ffff8000 h'ffff87ff h'ffffbfff boot program area ( 2 kbytes) programming control program area (14 kbytes) sh7052f sh7053f figure 20.11 ram areas in boot mode note: the boot program area cannot be used until a transition is made to the execution state for the programming control program transferred to ram. note also that the boot program remains in this area of the on-chip ram even after control branches to the programming control program.
708 20.6.2 user program mode after setting fwe, the user should branch to, and execute, the previously prepared programming/erase control program. use the following procedure (figure 20.12) to execute the programming control program that writes to flash memory (when transferred to ram). execute user application program execute programming/ erase control program in ram (flash memory rewriting) transfer programming/erase control program to ram fwe = 1 (user program mode) write fwe assessment program and transfer program 1 2 3 4 5 figure 20.12 user program mode execution procedure note: when programming and erasing, start the watchdog timer so that measures can be taken to prevent program runaway, etc. memory cells may not operate normally if overprogrammed or overerased due to program runaway. 20.7 programming/erasing flash memory a software method, using the cpu, is employed to program and erase flash memory in the on- board programming modes. there are four flash memory operating modes: program mode, erase mode, program-verify mode, and erase-verify mode. transitions to these modes are made by setting the psu1, esu1, p1, e1, pv1, and ev1 bits in flmcr1. the flash memory cannot be read while it is being written or erased. install the program to control flash memory programming and erasing (programming control program) in the on-chip ram, in
709 external memory, or in flash memory outside the address area, and execute the program from there. notes: 1. operation is not guaranteed if bits swe1, esu1, psu1, ev1, pv1, e1, and p1 of flmcr1 are set/reset by a program in flash memory in the corresponding address areas. 2. when programming or erasing, set fwe to 1 (programming/erasing will not be executed if fwe = 0). 3. programming should be performed in the erased state. do not perform additional programming on previously programmed addresses. 20.7.1 program mode when writing data or programs to flash memory, the program/program-verify flowchart shown in figures 20.13 and 20.14 should be followed. performing program operations according to this flowchart will enable data or programs to be written to flash memory without subjecting the device to voltage stress or sacrificing program data reliability. programming should be carried out 128 bytes at a time. following the elapse of 10 s or more after the swe1 bit is set to 1 in flash memory control register 1 (flmcr1), 128-byte program data is stored in the program data area and reprogram data area, and the 128-byte data in the program data area in ram is written consecutively to the program address (the lower 8 bits of the first address written to must be h'00 or h'80). 128 consecutive byte data transfers are performed. the program address and program data are latched in the flash memory. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to the extra addresses. next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc. set 6.6 ms as the wdt overflow period. after this, preparation for program mode (program setup) is carried out by setting the psu1 bit in flmcr1, and after the elapse of t spsu , the operating mode is switched to program mode by setting the p1 bit in flmcr1. the time during which the pn bit is set is the flash memory programming time. follow the table in the programming flowchart for the write time. after the elapse of a given programming time, programming mode is exited. in exiting programming mode, the p1 bit in flmcr1 is cleared, then after an interval of t cp or longer the psu1 bit is cleared, and after an interval of t cpsu or longer the watchdog timer is halted.
710 20.7.2 program-verify mode in program-verify mode, the data written in program mode is read to check whether it has been correctly written in the flash memory. a transition to program-verify mode is made by setting the pv1 bit in flmcr1 and waiting for an interval of t spv . before reading in program-verify mode, perform a dummy write of h'ff data to the read addresses, and then wait for an interval of t spvr or longer. when the flash memory is read in this state (verify data is read in longword units), the data at the latched address is read. next, the written data is compared with the verify data, and reprogram data is computed (see figures 20.13 and 20.14) and transferred to the reprogram data area. after 128 bytes of data have been verified, exit program-verify mode. program-verify mode is exited by clearing the pv1 bit in flmcr1, then clearing the swen bit after an interval of t cpv or longer, and waiting for an interval of t cswe or longer. if reprogramming is necessary, set program mode again, and repeat the program/program- verify sequence as before. however, ensure that the program/program-verify sequence is not repeated more than 1,000 times on the same bits.
711 start programming end set swe1 bit in flmcr1 wait: t sswe n = 1 m = 0 subroutine call no subroutine call see note 6 for pulse width no no no no no yes yes yes yes yes yes wait: t spv wait: t spvr * 2 * 4 * 1 * 1 write pulse (t sp10 ) set pv1 bit in flmcr1 perform h'ff dummy-write to verify address read verify data write data = verify data? 6 * 4 * 4 * 3 compute additional-programming data wait: t cswe m = 1 128 byte data verify complete? m = 0? increment address programming failure wait: t cswe clear swe1 bit in flmcr1 clear swe1 bit in flmcr1 successively write 128-byte data from reprogram data area in ram to flash memory write pulse (t sp30 or t sp200 ) store 128 bytes program data in program data area and reprogram data area transfer additional-programming data to additional-programming data area compute reprogram data clear pv1 bit in flmcr1 wait: t cpv transfer reprogram data to reprogram data area successively write 128-byte data from additional- programming data area in ram to flash memory n figure 20.13 program/program-verify flowchart (1)
712 return start of subroutine set psu1 bit in flmcr1 enable wdt set p1 bit in flmcr1 wait: t spsu clear p1 bit in flmcr1 wait: t sp10 , t sp30 , or t sp200 clear psu1 bit in flmcr1 wait: t cp disable wdt wait: t cpsu subroutine: write pulse * 5 reprogram data (x') 00 0 01 1 10 1 11 1 verify data (v) additional-programming data (y) comments additional programming executed additional programming not executed additional programming not executed additional programming not executed ram program data storage area (128 bytes) reprogram data storage area (128 bytes) additional program data storage area (128 byte) number of writes n 1 2 3 4 5 6 7 8 9 10 11 12 13 . . . 998 999 1000 write time (z) figure 20.14 program/program-verify flowchart (2)
713 table 20.8 program/program-verify parameter flow section item symbol min typ max unit notes program/ program-verify wait time after psu1 bit setting t spsu 50 50 20.7.3 erase mode when erasing flash memory, the erase/erase-verify flowchart (single-block erase) shown in figure 20.15 should be followed for each block. to perform data or program erasure, set the swe1 bit to 1 in flash memory control register n (flmcr1), then, after an interval of t sswe or longer, make a 1-bit setting for the flash memory area to be erased in erase block register 1 or 2 (ebr1, ebr2). next, the watchdog timer is set to prevent overerasing in the event of program runaway, etc. set 19.8 ms as the wdt overflow period. after this, preparation for erase mode (erase setup) is carried out by setting the esu1 bit in flmcr1, and after an interval of t sesu or longer, the operating mode is switched to erase mode by setting the e1 bit in flmcr1. the time during which the e1 bit is set is the flash memory erase time. ensure that the erase time does not exceed t se .
714 after the elapse of the erase time, erase mode is exited. in exiting erase mode, the e1 bit in flmcr1 is cleared, then after an interval of t ce or longer the esu1 bit is cleared, and after a further interval of t cesu or longer the watchdog timer is halted. note: with flash memory erasing, preprogramming (setting all memory data in the memory to be erased to all 0 ) is not necessary before starting the erase procedure. 20.7.4 erase-verify mode in erase-verify mode, data is read after memory has been erased to check whether it has been correctly erased. a transition to erase-verify mode is made by setting the e1 bit in flmcr1 and waiting for an interval of t sev . before reading in erase-verify mode, perform a dummy write of h'ff data to the read addresses, and then wait for an interval of t sevr or longer. when the flash memory is read in this state (verify data is read in longword units), the data at the latched address is read. if the read data has been erased (all 1 ), a dummy write is performed to the next address, and erase-verify is performed. if there are any unerased blocks, make a 1-bit setting for the flash memory area to be erased, and repeat the erase/erase-verify sequence as before. ensure that the operation is not repeated more than 100 times. when verification is completed, exit erase-verify mode. erase- verify mode is exited by clearing the ev1 bit in flmcr1, then waiting for an interval of t cev or longer. if erasure has been completed on all the erase blocks, clear the swe1 bit in flmcr1. if there are any unerased blocks, make a 1-bit setting for the flash memory area to be erased, and repeat the erase/erase-verify sequence as before.
715 end of erasing start set swe1 bit in flmcr1 set esu1 bit in flmcr1 set e1 bit in flmcr1 wait: t sswe wait: t sesu n = 1 set ebr1 and ebr2 enable wdt * 3 wait: t se wait: t ce wait: t cesu wait: t sev set block start address to verify address wait: t sevr wait: t cev * 2 * 4 clear e1 bit in flmcr1 clear esu1 bit in flmcr1 set ev1 bit in flmcr1 h'ff dummy write to verify address read verify data clear ev1 bit in flmcr1 wait: t cev clear ev1 bit in flmcr1 wait: t cswe disable wdt * 1 verify data = all "1"? last address of block? end of erasing of all erase blocks? erase failure wait: t cswe clear swe1 bit in flmcr1 clear swe1 bit in flmcr1 n figure 20.15 erase/erase-verify flowchart
716 table 20.9 erase/erase-verify parameter flow section item symbol min typ max unit notes erase/ erase-verify wait time after esu1 bit setting t sesu 100 100
717 20.8 protection there are two kinds of flash memory program/erase protection, hardware protection and software protection. 20.8.1 hardware protection hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted. hardware protection is reset by settings in flash memory control register 1 (flmcr1), erase block register 1 (ebr1), and erase block register 2 (ebr2). the flmcr1, ebr1, and ebr2 settings are retained in the error-protected state. (see table 20.10.) table 20.10 hardware protection functions item description program erase fwe pin protection ? ? ? res res res res
718 20.8.2 software protection software protection can be implemented by setting the swe1 bit in flmcr1, erase block register 1 (ebr1), erase block register 2 (ebr2), and the rams bit in the ram emulation register (ramer). when software protection is in effect, setting the p1 or e1 bit in flash memory control register 1 (flmcr1), does not cause a transition to program mode or erase mode. (see table 20.11.) table 20.11 software protection functions item description program erase swe bit protection ? ? ? ? 20.8.3 error protection in error protection, an error is detected when sh7052f/sh7053f runaway occurs during flash memory programming/erasing, or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. if the sh7052f/sh7053f malfunctions during flash memory programming/erasing, the fler bit is set to 1 in flmcr2 and the error protection state is entered. the flmcr1, flmcr2, ebr1, and ebr2 settings are retained, but program mode or erase mode is aborted at the point at which the error occurred. program mode or erase mode cannot be re-entered by re-setting the p1 or e1 bit. however, pv1 and ev1 bit setting is enabled, and a transition can be made to verify mode. fler bit setting conditions are as follows: 1. when the flash memory of the relevant address area is read during programming/erasing (including vector read and instruction fetch)
719 2. when a sleep instruction (including software standby) is executed during programming/erasing error protection is released only by a power-on reset and in hardware standby mode. figure 20.16 shows the flash memory state transition diagram. rd vf res hstby res hstby rd vf pr er pr er rd vf pr er res hstby rd vf pr er figure 20.16 flash memory state transitions
720 20.9 flash memory emulation in ram making a setting in the ram emulation register (ramer) enables part of ram to be overlapped onto the flash memory area so that data to be written to flash memory can be emulated in ram in real time. after the ramer setting has been made, accesses cannot be made from the flash memory area or the ram area overlapping flash memory. emulation can be performed in user mode and user program mode. figure 20.17 shows an example of emulation of real-time flash memory programming. start of emulation program end of emulation program tuning ok? yes no set ramer write tuning data to overlap ram execute application program clear ramer write to flash memory emulation block figure 20.17 flowchart for flash memory emulation in ram
721 h'00000 h'01000 h'02000 h'03000 h'04000 h'05000 h'06000 h'07000 h'08000 h'3ffff flash memory eb8 to eb11 eb0 eb1 eb2 eb3 eb4 eb5 eb6 eb7 h'ffff8000 h'ffff8fff h'ffffafff(sh7052f) h'ffffbfff(sh7053f) on-chip ram this area can be accessed from both the ram area and flash memory area figure 20.18 example of ram overlap operation example in which flash memory block area eb0 is overlapped 1. set bits rams and ram2 to ram0 in ramer to 1, 0, 0, 0, to overlap part of ram onto the area (eb0) for which real-time programming is required. 2. real-time programming is performed using the overlapping ram. 3. after the program data has been confirmed, the rams bit is cleared, releasing ram overlap. 4. the data written in the overlapping ram is written into the flash memory space (eb0). notes: 1. when the rams bit is set to 1, program/erase protection is enabled for all blocks regardless of the value of ram2 to ram0 (emulation protection). in this state, setting the p1 or e1 bit in flash memory control register 1 (flmcr1) will not cause a transition to program mode or erase mode. when actually programming or erasing a flash memory area, the rams bit should be cleared to 0. 2. a ram area cannot be erased by execution of software in accordance with the erase algorithm while flash memory emulation in ram is being used.
722 20.10 note on flash memory programming/erasing in the on-board programming modes (user mode and user program mode), nmi input should be disabled to give top priority to the program/erase operations (including ram emulation). do not perform a write to a rom area immediately after an atu register write cycle. for details, see writing to rom area immediately after atu register write in section 10.7, usage notes. when reading flash memory after changing the swe1 bit from 1 to 0 on completion of a program/erase operation, wait for at least t cswe after clearing swe1 to 0 before executing the flash memory read. regarding the timing of res input after changing the swe1 bit from 1 to 0 on completion of a program/erase operation, wait for at least t cswe after clearing swe1 to 0 before executing the reset operation. 20.11 flash memory programmer mode programs and data can be written and erased in programmer mode as well as in the on-board programming modes. in programmer mode, flash memory read mode, auto-program mode, auto- erase mode, and status read mode are supported. in auto-program mode, auto-erase mode, and status read mode, a status polling procedure is used, and in status read mode, detailed internal signals are output after execution of an auto-program or auto-erase operation. in programmer mode, set the mode pins to programmer mode (see table 20.12) and input a 6 mhz input clock, so that the sh7052f/sh7053f runs at 24 mhz. table 20.12 shows the pin settings for programmer mode. for the pin names in programmer mode, see section 1.3.2, pin functions. table 20.12 prom mode pin settings pin names settings mode pins: md2, md1, md0 0, 1, 1 fwe pin high level input (in auto-program and auto-erase modes) res
723 20.11.1 socket adapter pin correspondence diagram connect the socket adapter to the chip as shown in figure 20.20. this will enable conversion to a 40-pin arrangement. the on-chip rom memory map is shown in figure 20.19, and the socket adapter pin correspondence diagram in figure 20.20. h '00000000 a ddresses in m cu mode addresses in programmer mode h '0003ffff h'00000 h'3ffff on-chip rom space 256 kb figure 20.19 on-chip rom memory map
724 sh7052f and sh7053f socket adapter (conversion to 40-pin arrangement) pin no. pin name 188 189 190 191 192 193 195 197 198 199 200 201 202 203 204 206 208 1 2 35 36 37 38 39 40 41 43 119 121 120 28 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 d0 d1 d2 d3 d4 d5 d6 d7 ce oe we ce oe we res ce oe we figure 20.20 socket adapter pin correspondence diagram
725 20.11.2 programmer mode operation table 20.13 shows how the different operating modes are set when using programmer mode, and table 20.14 lists the commands used in programmer mode. details of each mode are given below. ? memory read mode memory read mode supports byte reads. ? auto-program mode auto-program mode supports programming of 128 bytes at a time. status polling is used to confirm the end of auto-programming. ? auto-erase mode auto-erase mode supports automatic erasing of the entire flash memory. status polling is used to confirm the end of auto-programming. ? status read mode status polling is used for auto-programming and auto-erasing, and normal termination can be confirmed by reading the i/o6 signal. in status read mode, error information is output if an error occurs. table 20.13 settings for various operating modes in programmer mode pin names mode fwe ce oe we i/o7 to i/o0 a18 to a0 read h or l l l h data output ain output disable h or l l h h hi-z x command write h or l l h l data input * ain chip disable h or l h x x hi-z x notes: 1. chip disable is not a standby state; internally, it is an operation state. 2. * ain indicates that there is also address input in auto-program mode. 3. for command writes in auto-program and auto-erase modes, input a high level to the fwe pin.
726 table 20.14 programmer mode commands number 1st cycle 2nd cycle command name of cycles mode address data mode address data memory read mode 1 + n write x h'00 read ra dout auto-program mode 129 write x h'40 write wa din auto-erase mode 2 write x h'20 write x h'20 status read mode 2 write x h'71 write x h'71 notes: 1. in auto-program mode, 129 cycles are required for command writing by a simultaneous 128-byte write. 2. in memory read mode, the number of cycles depends on the number of address write cycles (n). 20.11.3 memory read mode 1. after completion of auto-program/auto-erase/status read operations, a transition is made to the command wait state. when reading memory contents, a transition to memory read mode must first be made with a command write, after which the memory contents are read. 2. in memory read mode, command writes can be performed in the same way as in the command wait state. 3. once memory read mode has been entered, consecutive reads can be performed. 4. after powering on, memory read mode is entered. table 20.15 ac characteristics in transition to memory read mode (conditions: v cc = 3.3 v ?0%, v ss = 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce ce we we
727 ce oe ce oe we we figure 20.21 timing waveforms for memory read after memory write table 20.16 ac characteristics in transition from memory read mode to another mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce ce we we
728 ce oe we we oe figure 20.22 timing waveforms in transition from memory read mode to another mode table 20.17 ac characteristics in memory read mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes access time t acc 20 ? ce oe ce oe we figure 20.23 ce and oe enable state read timing waveforms
729 ce oe we figure 20.24 ce and oe clock system read timing waveforms 20.11.4 auto-program mode 1. in auto-program mode, 128 bytes are programmed simultaneously. this should be carried out by executing 128 consecutive byte transfers. 2. a 128-byte data transfer is necessary even when programming fewer than 128 bytes. in this case, h'ff data must be written to the extra addresses. 3. the lower 7 bits of the transfer address must be low. if a value other than an effective address is input, processing will switch to a memory write operation but a write error will be flagged. 4. memory address transfer is performed in the second cycle (figure 20.25). do not perform transfer after the second cycle. 5. do not perform a command write during a programming operation. 6. perform one auto-program operation for a 128-byte block for each address. two or more additional programming operations cannot be performed on a previously programmed address block. 7. confirm normal end of auto-programming by checking i/o6. alternatively, status read mode can also be used for this purpose (i/o7 status polling uses the auto-program operation end decision pin). 8. status polling i/o6 and i/o7 pin information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe .
730 table 20.18 ac characteristics in auto-program mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce ce we we ce oe we figure 20.25 auto-program mode timing waveforms
731 20.11.5 auto-erase mode 1. auto-erase mode supports only entire memory erasing. 2. do not perform a command write during auto-erasing. 3. confirm normal end of auto-erasing by checking i/o6. alternatively, status read mode can also be used for this purpose (i/o7 status polling uses the auto-erase operation end decision pin). 4. status polling i/o6 and i/o7 pin information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe . table 20.19 ac characteristics in auto-erase mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce ce we we
732 ce oe we erase end decision signal erase normal end decision signal figure 20.26 auto-erase mode timing waveforms
733 20.11.6 status read mode 1. status read mode is provided to identify the kind of abnormal end. use this mode when an abnormal end occurs in auto-program mode or auto-erase mode. 2. the return code is retained until a command write other than a status read mode command write is executed. table 20.20 ac characteristics in status read mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes read time after command write t nxtc 20 ? ce ce oe ce we we ce oe we t wep t f t r h'71 note: i/o2 and i/o3 are undefined. figure 20.27 status read mode timing waveforms
734 table 20.21 status read mode return commands pin name i/o7 i/o6 i/o5 i/o4 i/o3 i/o2 i/o1 i/o0 attribute normal end decision command error program- ming error erase error program- ming or erase count exceeded effective address error initial value 00000000 indications normal end: 0 abnormal end: 1 command error: 1 otherwise: 0 program- ming error: 1 otherwise: 0 erasing error: 1 otherwise: 0 count exceeded: 1 otherwise: 0 effective address error: 1 otherwise: 0 note: i/o2 and i/o3 are undefined. 20.11.7 status polling 1. the i/o7 status polling flag indicates the operating status in auto-program/auto-erase mode. 2. the i/o6 status polling flag indicates a normal or abnormal end in auto-program/auto-erase mode. table 20.22 status polling output truth table pin name during internal operation abnormal end normal end i/o7 0101 i/o6 0011 i/o0 to i/o5 0000 20.11.8 programmer mode transition time commands cannot be accepted during the oscillation stabilization period or the programmer mode setup period. after the programmer mode setup time, a transition is made to memory read mode. table 20.23 stipulated transition times to command wait state item symbol min max unit notes standby release (oscillation stabilization time) t osc1 30 ms programmer mode setup time t bmv 10 ms v cc hold time t dwn 0ms
735 t osc1 t bmv t dwn v cc res figure 20.28 oscillation stabilization time, boot program transfer time, and power-down sequence 20.11.9 notes on memory programming 1. when programming addresses which have previously been programmed, carry out auto- erasing before auto-programming. 2. when performing programming using programmer mode on a chip that has been programmed/erased in an on-board programming mode, auto-erasing is recommended before carrying out auto-programming. notes: 1. the flash memory is initially in the erased state when the device is shipped by hitachi. for other chips for which the erasure history is unknown, it is recommended that auto- erasing be executed to check and supplement the initialization (erase) level. 2. auto-programming should be performed once only on the same address block. additional programming cannot be performed on previously programmed address blocks.
736
737 section 21 rom (sh7054f) 21.1 features the sh7054f has 384 kbytes of on-chip flash memory. the features of the flash memory are summarized below. ? four flash memory operating modes ? program mode ? erase mode ? program-verify mode ? erase-verify mode ? programming/erase methods the flash memory is programmed 128 bytes at a time. block erase (in single-block units) can be performed. to erase the entire flash memory, individual blocks must be erased in turn. block erasing can be performed as required on 4 kb, 32 kb, and 64 kb blocks. ? programming/erase times the flash memory programming time is 7 ms (typ.) for simultaneous 128-byte programming, equivalent to 55 ? (typ.) per byte, and the erase time is 100 ms (typ.) per block. ? reprogramming capability the flash memory can be reprogrammed up to 100 times. ? on-board programming modes there are two modes in which flash memory can be programmed/erased/verified on-board: ? boot mode ? user program mode ? automatic bit rate adjustment with data transfer in boot mode, the sh7054f? bit rate can be automatically adjusted to match the transfer bit rate of the host. ? flash memory emulation in ram flash memory programming can be emulated in real time by overlapping a part of ram onto flash memory. ? protect modes there are two protect modes, hardware and software, which allow protected status to be designated for flash memory program/erase/verify operations. ? programmer mode flash memory can be programmed/erased in programmer mode, using a prom programmer, as well as in on-board programming mode.
738 21.2 overview 21.2.1 block diagram module bus bus interface/controller flash memory (384 kb) operating mode flmcr2 internal address bus internal data bus (32 bits) fwe pin mode pin ebr1 ebr2 ramer flmcr1 flash memory control register 1 flash memory control register 2 erase block register 1 erase block register 2 ram emulation register legend flmcr1: flmcr2: ebr1: ebr2: ramer: figure 21.1 block diagram of flash memory
739 21.2.2 mode transitions when the mode pins and the fwe pin are set in the reset state and a reset-start is executed, the microcomputer enters an operating mode as shown in figure 21.2. in user mode, flash memory can be read but not programmed or erased. the boot, user program and programmer modes are provided as modes to write and erase the flash memory. boot mode on-board programming mode user program mode user mode reset state programmer mode res * 1 * 1 * 2 notes: only make a transition between user mode and user program mode when the cpu is not accessing the flash memory. 1. ram emulation possible 2. md0 = 1, md1 = 1, md2 = 0 res res res figure 21.2 flash memory state transitions
740 21.2.3 on-board programming modes boot mode flash memory sh7054f ram host programming control program sci application program (old version) new application program flash memory sh7054f ram host sci application program (old version) boot program area new application program flash memory sh7054f ram host sci flash memory preprogramming erase boot program new application program flash memory sh7054f program execution state ram host sci new application program boot program programming control program 1. initial state the old program version or data remains written in the flash memory. the user should prepare the programming control program and new application program beforehand in the host. 2. programming control program transfer when boot mode is entered, the boot program in the sh7054f (originally incorporated in the chip) is started and the programming control program in the host is transferred to ram via sci communication. the boot program required for flash memory erasing is automatically transferred to the ram boot program area. 3. flash memory initialization the erase program in the boot program area (in ram) is executed, and the flash memory is initialized (to h'ff). in boot mode, total flash memory erasure is performed, without regard to blocks. 4. writing new application program the programming control program transferred from the host to ram is executed, and the new application program in the host is written into the flash memory. programming control program boot program boot program boot program area boot program area programming control program figure 21.3 boot mode
741 user program mode flash memory sh7054f ram host programming/ erase control program sci boot program new application program flash memory sh7054f ram host sci new application program flash memory sh7054f ram host sci flash memory erase boot program new application program flash memory sh7054f program execution state ram host sci boot program boot program fwe assessment program application program (old version) new application program 1. initial state the fwe assessment program that confirms that user program mode has been entered, and the program that will transfer the programming/erase control program from flash memory to on-chip ram should be written into the flash memory by the user beforehand. the programming/erase control program should be prepared in the host or in the flash memory. 2. programming/erase control program transfer when user program mode is entered, user software confirms this fact, executes transfer program in the flash memory, and transfers the programming/erase control program to ram. 3. flash memory initialization the programming/erase program in ram is executed, and the flash memory is initialized (to h'ff). erasing can be performed in block units, but not in byte units. 4. writing new application program next, the new application program in the host is written into the erased flash memory blocks. do not write to unerased blocks. programming/ erase control program programming/ erase control program programming/ erase control program transfer program application program (old version) transfer program fwe assessment program fwe assessment program transfer program fwe assessment program transfer program figure 21.4 user program mode
742 21.2.4 flash memory emulation in ram emulation should be performed in user mode or user program mode. when the emulation block set in ramer is accessed while the emulation function is being executed, data written in the overlap ram is read. user mode ? user program mode application program execution state flash memory emulation block ram sci overlap ram (emulation is performed on data written in ram) figure 21.5 emulation when overlap ram data is confirmed, the rams bit is cleared, ram overlap is released, and writes should actually be performed to the flash memory. when the programming control program is transferred to ram, ensure that the transfer destination and the overlap ram do not overlap, as this will cause data in the overlap ram to be rewritten.
743 ? user program mode application program flash memory ram sci programming control program execution state overlap ram (programming data) programming data figure 21.6 programming flash memory 21.2.5 differences between boot mode and user program mode table 21.1 differences between boot mode and user mode boot mode user program mode total erase yes yes block erase no yes programming control program * (2) (1) (2) (3) (1) erase/erase-verify (2) program/program-verify (3) emulation note: * to be provided by the user, in accordance with the recommended algorithm.
744 21.2.6 block configuration the flash memory is divided into five 64 kb blocks, one 32 kb block, and eight 4 kb blocks. address h'5ffff address h'00000 64 kb 64 kb 64 kb 64 kb 64 kb 32 kb 384 kb 4 kb figure 21.7 block configuration 21.3 pin configuration the flash memory is controlled by means of the pins shown in table 21.2. table 21.2 pin configuration pin name abbreviation i/o function reset res
745 21.4 register configuration the registers used to control the on-chip flash memory when enabled are shown in table 21.3. table 21.3 register configuration register name abbreviation r/w initial value address access size flash memory control register 1 flmcr1 r/w * 1 h'00 * 2 h'ffffe800 8 flash memory control register 2 flmcr2 r/w * 1 h'00 h'ffffe801 8 erase block register 1 ebr1 r/w * 1 h'00 * 3 h'ffffe802 8 erase block register 2 ebr2 r/w * 1 h'00 * 4 h'ffffe803 8 ram emulation register ramer r/w h'0000 h'ffffec26 8, 16, 32 notes: 1. in modes in which the on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes are also disabled when the fwe bit is set to 1 in flmcr1. 2. when a high level is input to the fwe pin, the initial value is h'80. 3. when a low level is input to the fwe pin, or if a high level is input and the swe1 bit in flmcr1 is not set, these registers are initialized to h'00. 4. will be initialized to h'00 if a low level is input to pin fwe or if bit swe2 of flmcr2 is not set even though a high level is input. 5. flmcr1, flmcr2, ebr1, and ebr2 are 8-bit registers, and ramer is a 16-bit register. 6. only byte accesses are valid for flmcr1, flmcr2, ebr1, and ebr2, the access requiring 3 cycles. three cycles are required for a byte or word access to ramer, and 6 cycles for a longword access.
746 21.5 register descriptions 21.5.1 flash memory control register 1 (flmcr1) flmcr1 is an 8-bit register used for flash memory operating mode control. program-verify mode or erase-verify mode is entered by setting swe1 bit to 1 when fwe = 1, then setting the ev1 or pv1 bit. program mode is entered by setting swe1 bit to 1 when fwe = 1, then setting the psu1 bit, and finally setting the p1 bit. erase mode is entered by setting swe1 bit to 1 when fwe = 1, then setting the esu1 bit, and finally setting the e1 bit. flmcr1 is initialized by a power-on reset, and in hardware standby mode and software standby mode. its initial value is h'80 when a high level is input to the fwe pin, and h'00 when a low level is input. when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. writes are enabled only in the following cases: writes to bit swe1 of flmcr1 enabled when fwe = 1, to bits esu1, psu1, ev1, and pv1 when fwe = 1 and swe1 = 1, to bit e1 when fwe = 1, swe1 = 1 and esu1 = 1, and to bit p1 when fwe = 1, swe1 = 1, and psu1 = 1. bit: 7 6 5 4 3 2 1 0 fwe swe1 esu1 psu1 ev1 pv1 e1 p1 initial value: 1/0 0 0 0 0 0 0 0 r/w: r r/w r/w r/w r/w r/w r/w r/w ? bit 7 flash write enable bit (fwe): sets hardware protection against flash memory programming/erasing. bit 7: fwe description 0 when a low level is input to the fwe pin (hardware-protected state) 1 when a high level is input to the fwe pin ? bit 6 software write enable bit 1 (swe1): enables or disables flash memory programming and erasing. set this bit when setting bits 5 to 0, bits 7 to 0 of ebr1, and bits 3 to 0 of ebr2. bit 6: swe1 description 0 writes disabled (initial value) 1 writes enabled [setting condition] when fwe = 1 ? bit 5 erase setup bit 1 (esu1): prepares for a transition to erase mode. do not set the swe1, psu1, ev1, pv1, e1, or p1 bit at the same time.
747 bit 5: esu1 description 0 erase setup cleared (initial value) 1 erase setup [setting condition] when fwe = 1 and swe1 = 1 ? bit 4 program setup bit 1 (psu1): prepares for a transition to program mode. do not set the swe1, esu1, ev1, pv1, e1, or p1 bit at the same time. bit 4: psu1 description 0 program setup cleared (initial value) 1 program setup [setting condition] when fwe = 1 and swe1 = 1 ? bit 3 erase-verify 1 (ev1): selects erase-verify mode transition or clearing. do not set the swe1, esu1, psu1, pv1, e1, or p1 bit at the same time. bit 3: ev1 description 0 erase-verify mode cleared (initial value) 1 transition to erase-verify mode [setting condition] when fwe = 1 and swe1 = 1 ? bit 2 program-verify 1 (pv1): selects program-verify mode transition or clearing. do not set the swe1, esu1, psu1, ev1, e1, or p1 bit at the same time. bit 2: pv1 description 0 program-verify mode cleared (initial value) 1 transition to program-verify mode [setting condition] when fwe = 1 and swe1 = 1
748 ? bit 1 erase 1 (e1): selects erase mode transition or clearing. do not set the swe1, esu1, psu1, ev1, pv1, or p1 bit at the same time. bit 1: e1 description 0 erase mode cleared (initial value) 1 transition to erase mode [setting condition] when fwe = 1, swe1 = 1, and esu1 = 1 ? bit 0 program 1 (p1): selects program mode transition or clearing. do not set the swe1, psu1, esu1, ev1, pv1, or e1 bit at the same time. bit 0: p1 description 0 program mode cleared (initial value) 1 transition to program mode [setting condition] when fwe = 1, swe1 = 1, and psu1 = 1 21.5.2 flash memory control register 2 (flmcr2) flmcr2 is a status register that indicates the occurrence of an error during flash memory programming or erasing. flmcr2 is initialized to h'00 by a power-on reset and in hardware standby mode. when on-chip flash memory is disabled, a read will return h'00 and writes are invalid. bit: 7 6 5 4 3 2 1 0 fler ?? ?? ? ??
749 ? bit 7 flash memory error (fler): indicates that an error has occurred during an operation on flash memory (programming or erasing). when fler is set to 1, flash memory goes to the error-protection state. bit 7: fler description 0 flash memory is operating normally (initial value) flash memory program/erase protection (error protection) is disabled [clearing condition] power-on reset or hardware standby mode 1 an error has occurred during flash memory programming/erasing flash memory program/erase protection (error protection) is enabled [setting condition] see 201.8.3 error protection ? bits 6 to 0 reserved: these bits always read 0. the write value should always be 0. 21.5.3 erase block register 1 (ebr1) ebr1 is an 8-bit register that specifies the flash memory erase area block by block. ebr1 is initialized to h'00 by a power-on reset, in hardware standby mode and software standby mode, when a low level is input to the fwe pin, and when a high level is input to the fwe pin and the swe1 bit in flmcr1 is not set. when a bit in ebr1 is set to 1, the corresponding block can be erased. other blocks are erase-protected. only one of the bits of ebr1 and ebr2 combined can be set. do not set more than one bit. (do not set more than one bit, as this will automatically clear both ebr1 and ebr2 to 0.) when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. the flash memory block configuration is shown in table 21.4. bit: 7 6 5 4 3 2 1 0 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 initial value: 0 0 0 0 0 0 0 0 r/w: r/w r/w r/w r/w r/w r/w r/w r/w 21.5.4 erase block register 2 (ebr2) ebr2 is an 8-bit register that specifies the flash memory erase area block by block. ebr2 is initialized to h'00 by a power-on reset, in hardware standby mode and software standby mode, when a low level is input to the fwe pin. bits 3 to 0 will be initialized even though a high level is input to pin fwe. when a bit in ebr2 is set to 1, the corresponding block can be erased. other
750 blocks are erase-protected. only one of the bits of ebr1 and ebr2 combined can be set. do not set more than one bit. (do not set more than one bit, as this will automatically clear both ebr1 and ebr2 to 0.) when on-chip flash memory is disabled, a read will return h'00, and writes are invalid. the flash memory block configuration is shown in table 21.5. bit: 7 6 5 4 3 2 1 0 ?? table 21.4 flash memory erase blocks block (size) addresses eb0 (4 kb) h'000000 to h'000fff eb1 (4 kb) h'001000 to h'001fff eb2 (4 kb) h'002000 to h'002fff eb3 (4 kb) h'003000 to h'003fff eb4 (4 kb) h'004000 to h'004fff eb5 (4 kb) h'005000 to h'005fff eb6 (4 kb) h'006000 to h'006fff eb7 (4 kb) h'007000 to h'007fff eb8 (32 kb) h'008000 to h'00ffff eb9 (64 kb) h'010000 to h'01ffff eb10 (64 kb) h'020000 to h'02ffff eb11 (64 kb) h'030000 to h'03ffff eb12 (64 kb) h'040000 to h'04ffff eb13 (64 kb) h'050000 to h'05ffff
751 21.5.5 ram emulation register (ramer) ramer specifies the area of flash memory to be overlapped with part of ram when emulating real-time flash memory programming. ramer is initialized to h'0000 by a power-on reset and in hardware standby mode. it is not initialized in software standby mode. ramer settings should be made in user mode or user program mode. flash memory area divisions are shown in table 21.5. to ensure correct operation of the emulation function, the rom for which ram emulation is performed should not be accessed immediately after this register has been modified. normal execution of an access immediately after register modification is not guaranteed. bit: 15 14 13 12 11 10 9 8 ???????? initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r r r r bit: 7 6 5 4 3 2 1 0 ? ? ? ? rams ram2 ram1 ram0 initial value: 0 0 0 0 0 0 0 0 r/w: r r r r r/w r/w r/w r/w ? bits 15 to 4 reserved: these bits always read 0. ? bit 3 ram select (rams): specifies selection or non-selection of flash memory emulation in ram. when rams = 1, all flash memory block are program/erase-protected. bit 3: rams description 0 emulation not selected (initial value) program/erase-protection of all flash memory blocks is disabled 1 emulation selected program/erase-protection of all flash memory blocks is enabled
752 ? bits 2, 1 and 0 flash memory area selection (ram2, ram1, ram0): these bits are used together with bit 3 to select the flash memory area to be overlapped with ram. (see table 21.5.) table 21.5 flash memory area divisions addresses block name rams ram1 ram1 ram0 h'ffff8000 to h'ffff8fff ram area 4 kb 0 ** * h'00000000 to h'00000fff eb0 (4 kb) 1 0 0 0 h'00001000 to h'00001fff eb1 (4 kb) 1 0 0 1 h'00002000 to h'00002fff eb2 (4 kb) 1 0 1 0 h'00003000 to h'00003fff eb3 (4 kb) 1 0 1 1 h'00004000 to h'00004fff eb4 (4 kb) 1 1 0 0 h'00005000 to h'00005fff eb5 (4 kb) 1 1 0 1 h'00006000 to h'00006fff eb6 (4 kb) 1 1 1 0 h'00007000 to h'00007fff eb7 (4 kb) 1 1 1 1 * : don't care
753 21.6 on-board programming modes when pins are set to on-board programming mode and a reset-start is executed, a transition is made to the on-board programming state in which program/erase/verify operations can be performed on the on-chip flash memory. there are two on-board programming modes: boot mode and user program mode. the pin settings for transition to each of these modes are shown in table 21.6. for a diagram of the transitions to the various flash memory modes, see figure 21.2. table 21.6 setting on-board programming modes mode pll multiple fwe md2 md1 md0 boot mode expanded mode 21.6.1 boot mode when boot mode is used, the flash memory programming control program must be prepared in the host beforehand. the sci channel to be used is set to asynchronous mode. when a reset-start is executed after the sh7054f s pins have been set to boot mode, the boot program built into the sh7054f is started and the programming control program prepared in the host is serially transmitted to the sh7054f via the sci. in the sh7054f, the programming control program received via the sci is written into the programming control program area in on-chip ram. after the transfer is completed, control branches to the start address of the programming control program area and the programming control program execution state is entered (flash memory programming is performed). the transferred programming control program must therefore include coding that follows the programming algorithm given later. the system configuration in boot mode is shown in figure 21.8, and the boot mode execution procedure in figure 21.9.
754 rxd1 txd1 sci1 sh7054f flash memory write data reception verify data transmission host on-chip ram figure 21.8 system configuration in boot mode
755 note: if a memory cell does not operate normally and cannot be erased, one h'ff byte is transmitted as an erase error, and the erase operation and subsequent operations are halted. start set pins to boot mode and execute reset-start host transfers data (h'00) continuously at prescribed bit rate sh7054f measures low period of h'00 data transmitted by host sh7054f calculates bit rate and sets value in bit rate register after bit rate adjustment, sh7054f transmits one h'00 data byte to host to indicate end of adjustment host confirms normal reception of bit rate adjustment end indication (h'00), and transmits one h'55 data byte after receiving h'55, sh7054f transmits one h'aa data byte to host host transmits number of programming control program bytes (n), upper byte followed by lower byte sh7054f transmits received number of bytes to host as verify data (echo-back) n = 1 host transmits programming control program sequentially in byte units sh7054f transmits received programming control program to host as verify data (echo-back) transfer received programming control program to on-chip ram n = n? no yes end of transmission check flash memory data, and if data has already been written, erase all blocks after confirming that all flash memory data has been erased, sh7054f transmits one h'aa data byte to host execute programming control program transferred to on-chip ram n + 1 figure 21.9 boot mode execution procedure
756 automatic sci bit rate adjustment start bit stop bit d0 d1 d2 d3 d4 d5 d6 d7 low period (9 bits) measured (h'00 data) high period (1 or more bits) figure 21.10 automatic sci bit rate ajustment when boot mode is initiated, the sh7054f measures the low period of the asynchronous sci communication data (h'00) transmitted continuously from the host. the sci transmit/receive format should be set as follows: 8-bit data, 1 stop bit, no parity. the sh7054f calculates the bit rate of the transmission from the host from the measured low period, and transmits one h'00 byte to the host to indicate the end of bit rate adjustment. the host should confirm that this adjustment end indication (h'00) has been received normally, and transmit one h'55 byte to the sh7054f. if reception cannot be performed normally, initiate boot mode again (reset), and repeat the above operations. depending on the host s transmission bit rate and the sh7054f s system clock frequency, there will be a discrepancy between the bit rates of the host and the sh7054f. set the host transfer bit rate at 9,600 or 19,200 bps to operate the sci properly. table 21.7 shows host transfer bit rates and system clock frequencies for which automatic adjustment of the sh7054f bit rate is possible. the boot program should be executed within this system clock range. table 21.7 system clock frequencies for which automatic adjustment of sh7054f bit rate is possible host bit rate system clock frequency for which automatic adjustment of sh7054f bit rate is possible 9,600 bps 20 to 40 mhz (input frequency: 5 to 10 mhz) 19,200 bps 20 to 40 mhz (input frequency: 5 to 10 mhz)
757 on-chip ram area divisions in boot mode: in boot mode, the ram area is divided into an area used by the boot program and an area to which the programming control program is transferred via the sci, as shown in figure 21.11. the boot program area cannot be used until the execution state in boot mode switches to the programming control program transferred from the host. h'ffff8000 h'ffff87ff h'ffffbfff boot program area ( 2 kbytes) programming control program area (14 kbytes) figure 21.11 ram areas in boot mode note: the boot program area cannot be used until a transition is made to the execution state for the programming control program transferred to ram. note also that the boot program remains in this area of the on-chip ram even after control branches to the programming control program.
758 21.6.2 user program mode after setting fwe, the user should branch to, and execute, the previously prepared programming/erase control program. the flash memory cannot be read while the flash memory is being written/erased. execute the control program for programming or erasing using the on-chip ram, external memory, or flash memory outside the address areas. use the following procedure (figure 21.12) to execute the programming control program that writes to flash memory (when transferred to ram). execute user application program execute programming/ erase control program in ram (flash memory rewriting) transfer programming/erase control program to ram fwe = 1 (user program mode) write fwe assessment program and transfer program 1 2 3 4 5 figure 21.12 user program mode execution procedure note: when programming and erasing, start the watchdog timer so that measures can be taken to prevent program runaway, etc. memory cells may not operate normally if overprogrammed or overerased due to program runaway.
759 21.7 programming/erasing flash memory a software method, using the cpu, is employed to program and erase flash memory in the on- board programming modes. there are four flash memory operating modes: program mode, erase mode, program-verify mode, and erase-verify mode. transitions to these modes are made by setting the psu1, esu1, p1, e1, pv1, and ev1 bits in flmcr1. the flash memory cannot be read while it is being written or erased. install the program to control flash memory programming and erasing (programming control program) in the on-chip ram, in external memory, or in flash memory outside the address area, and execute the program from there. notes: 1. operation is not guaranteed if bits swe1, esu1, psu1, ev1, pv1, e1, and p1 of flmcr1 are set/reset by a program in flash memory in the corresponding address areas. 2. when programming or erasing, set fwe to 1 (programming/erasing will not be executed if fwe = 0). 3. programming should be performed in the erased state. do not perform additional programming on previously programmed addresses. 21.7.1 program mode when writing data or programs to flash memory, the program/program-verify flowchart shown in figures 21.13 and 21.14 should be followed. performing program operations according to this flowchart will enable data or programs to be written to flash memory without subjecting the device to voltage stress or sacrificing program data reliability. programming should be carried out 128 bytes at a time. following the elapse of 10 s or more after the swe1 bit is set to 1 in flash memory control register 1 (flmcr1), 128-byte program data is stored in the program data area and reprogram data area, and the 128-byte data in the program data area in ram is written consecutively to the program address (the lower 8 bits of the first address written to must be h'00 or h'80). 128 consecutive byte data transfers are performed. the program address and program data are latched in the flash memory. a 128-byte data transfer must be performed even if writing fewer than 128 bytes; in this case, h'ff data must be written to the extra addresses. next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc. set 6.6 ms as the wdt overflow period. after this, preparation for program mode (program setup) is carried out by setting the psu1 bit in flmcr1, and after the elapse of t spsu , the operating mode is switched to program mode by setting the p1 bit in flmcr1. the time during which the p1 bit is set is the flash memory programming time. follow the table in the programming flowchart for the write time.
760 after the elapse of a given programming time, programming mode is exited. in exiting programming mode, the p1 bit in flmcr1 is cleared, then after an interval of t cp or longer the psu1 bit is cleared, and after an interval of t cpsu or longer the watchdog timer is halted. 21.7.2 program-verify mode in program-verify mode, the data written in program mode is read to check whether it has been correctly written in the flash memory. a transition to program-verify mode is made by setting the pv1 bit in flmcr1 and waiting for an interval of t spv . before reading in program-verify mode, perform a dummy write of h'ff data to the read addresses, and then wait for an interval of t spvr or longer. when the flash memory is read in this state (verify data is read in longword units), the data at the latched address is read. next, the written data is compared with the verify data, and reprogram data is computed (see figures 21.13 and 21.14) and transferred to the reprogram data area. after 128 bytes of data have been verified, exit program-verify mode. program-verify mode is exited by clearing the pv1 bit in flmcr1, then clearing the swe1 bit after an interval of t cpv or longer, and waiting for an interval of t cswe or longer. if reprogramming is necessary, set program mode again, and repeat the program/program- verify sequence as before. however, ensure that the program/program-verify sequence is not repeated more than 1,000 times on the same bits.
761 start programming end set swe1 bit in flmcr1 wait: t sswe n = 1 m = 0 subroutine call no subroutine call see note 6 for pulse width no no no no no yes yes yes yes yes yes wait: t spv wait: t spvr * 2 * 4 * 1 * 1 write pulse (t sp10 ) set pv1 bit in flmcr1 perform h'ff dummy-write to verify address read verify data write data = verify data? 6 * 4 * 4 * 3 compute additional-programming data wait: t cswe m = 1 128 byte data verify complete? m = 0? increment address programming failure wait: t cswe clear swe1 bit in flmcr1 clear swe1 bit in flmcr1 n figure 21.13 program/program-verify flowchart (1)
762 return start of subroutine set psu1 bit in flmcr1 enable wdt set p1 bit in flmcr1 wait: t spsu clear p1 bit in flmcr1 wait: t sp10 , t sp30 or t sp200 clear psu1 bit in flmcr1 wait: t cp disable wdt wait: t cpsu subroutine: write pulse * 5 reprogram data (x') 00 0 01 1 10 1 11 1 verify data (v) additional-programming data (y) comments additional programming executed additional programming not executed additional programming not executed additional programming not executed ram program data storage area (128 bytes) reprogram data storage area (128 bytes) additional program data storage area (128 byte) number of writes n 1 2 3 4 5 6 7 8 9 10 11 12 13 . . . 998 999 1000 write time (z) figure 21.14 program/program-verify flowchart (2)
763 table 21.8 program/program-verify parameter flow section item symbol min typ max unit notes program/ program-verify wait time after psu1 bit setting t spsu 50 50 21.7.3 erase mode when erasing flash memory, the erase/erase-verify flowchart (single-block erase) shown in figure 21.15 should be followed for each block. to perform data or program erasure, set the swe1 bit to 1 in flash memory control register n (flmcr1), then, after an interval of t sswe or longer, make a 1-bit setting for the flash memory area to be erased in erase block register 1 or 2 (ebr1, ebr2). next, the watchdog timer is set to prevent overerasing in the event of program runaway, etc. set 19.8 ms as the wdt overflow period. after this, preparation for erase mode (erase setup) is carried out by setting the esu1 bit in flmcr1, and after an interval of t sesu or longer, the operating mode is switched to erase mode by setting the e1 bit in flmcr1. the time during which the e1 bit is set is the flash memory erase time. ensure that the erase time does not exceed t se .
764 after the elapse of the erase time, erase mode is exited. in exiting erase mode, the e1 bit in flmcr1 is cleared, then after an interval of t ce or longer the esu1 bit is cleared, and after a further interval of t cesu or longer the watchdog timer is halted. note: with flash memory erasing, preprogramming (setting all memory data in the memory to be erased to all 0 ) is not necessary before starting the erase procedure. 21.7.4 erase-verify mode in erase-verify mode, data is read after memory has been erased to check whether it has been correctly erased. a transition to erase-verify mode is made by setting the e1 bit in flmcr1 and waiting for an interval of t sev . before reading in erase-verify mode, perform a dummy write of h'ff data to the read addresses, and then wait for an interval of t sevr or longer. when the flash memory is read in this state (verify data is read in longword units), the data at the latched address is read. if the read data has been erased (all 1 ), a dummy write is performed to the next address, and erase-verify is performed. the erase-verify operation is carried out on all the erase blocks; the erase block register bit for an erased block should be cleared to prevent excessive application of the erase voltage. ensure that the operation is not repeated more than 100 times. when verification is completed, exit erase-verify mode. erase-verify mode is exited by clearing the ev1 bit in flmcr1, then waiting for an interval of t cev or longer. if erasure has been completed on all the erase blocks, clear the swe1 bit in flmcr1. if there are any unerased blocks, make a 1-bit setting for the flash memory area to be erased, and repeat the erase/erase-verify sequence as before.
765 end of erasing start set swe1 bit in flmcr1 set esu1 bit in flmcr1 set e1 bit in flmcr1 wait: t sswe wait: t sesu n = 1 set ebr1, 2 enable wdt * 3 wait: t se wait: t ce wait: t cesu wait: t sev set block start address to verify address wait: t sevr wait: t cev * 2 * 4 start erase clear e1 bit in flmcr1 clear esu1 bit in flmcr1 set ev1 bit in flmcr1 h'ff dummy write to verify address read verify data clear ev1 bit in flmcr1 wait: t cev clear ev1 bit in flmcr1 wait: t cswe disable wdt halt erase * 1 verify data = all "1"? last address of block? end of erasing of all erase blocks? erase failure wait: t cswe clear swe1 bit in flmcr1 clear swe1 bit in flmcr1 n figure 21.15 erase/erase-verify flowchart
766 table 21.9 erase/erase-verify parameter flow section item symbol min typ max unit notes erase/ erase-verify wait time after esu1 bit setting t sesu 100 100
767 21.8 protection there are two kinds of flash memory program/erase protection, hardware protection and software protection. 21.8.1 hardware protection hardware protection refers to a state in which programming/erasing of flash memory is forcibly disabled or aborted. hardware protection is reset by settings in flash memory control register 1 (flmcr1), erase block register 1 (ebr1) and erase block register 2 (ebr2). the flmcr1, and ebr1 settings are retained in the error-protected state. (see table 21.10.) table 21.10 hardware protection functions item description program erase fwe pin protection ? ? ? res res res res
768 21.8.2 software protection software protection can be implemented by setting the swe1 bit in flmcr1, erase block register 1 (ebr1), erase block register 2 (ebr2), and the rams bit in the ram emulation register (ramer). when software protection is in effect, setting the p1 or e1 bit in flash memory control register 1 (flmcr1), does not cause a transition to program mode or erase mode. (see table 21.11.) table 21.11 software protection functions item description program erase swe bit protection ? ? ? ? 21.8.3 error protection in error protection, an error is detected when sh7054f runaway occurs during flash memory programming/erasing, or operation is not performed in accordance with the program/erase algorithm, and the program/erase operation is aborted. aborting the program/erase operation prevents damage to the flash memory due to overprogramming or overerasing. if the sh7054f malfunctions during flash memory programming/erasing, the fler bit is set to 1 in flmcr2 and the error protection state is entered. the flmcr1, ebr1, and ebr2 settings are retained, but program mode or erase mode is aborted at the point at which the error occurred. program mode or erase mode cannot be re-entered by re-setting the p1 or e1 bit. however, pv1 and ev1 bit setting is enabled, and a transition can be made to verify mode. fler bit setting conditions are as follows: 1. when the flash memory of the relevant address area is read during programming/erasing (including vector read and instruction fetch) 2. when a sleep instruction (including software standby) is executed during programming/erasing
769 error protection is released only by a power-on reset and in hardware standby mode. figure 21.16 shows the flash memory state transition diagram. rd vf res hstby res hstby rd vf pr er pr er rd vf pr er res hstby rd vf pr er figure 21.16 flash memory state transitions
770 21.9 flash memory emulation in ram making a setting in the ram emulation register (ramer) enables part of ram to be overlapped onto the flash memory area so that data to be written to flash memory can be emulated in ram in real time. after the ramer setting has been made, accesses cannot be made from the flash memory area or the ram area overlapping flash memory. emulation can be performed in user mode and user program mode. figure 21.17 shows an example of emulation of real-time flash memory programming. start of emulation program end of emulation program tuning ok? yes no set ramer write tuning data to overlap ram execute application program clear ramer write to flash memory emulation block figure 21.17 flowchart for flash memory emulation in ram
771 h'00000 h'01000 h'02000 h'03000 h'04000 h'05000 h'06000 h'07000 h'08000 h'5ffff flash memory eb8 to eb13 eb0 eb1 eb2 eb3 eb4 eb5 eb6 eb7 h'ffff8000 h'ffff8fff h'ffffbfff on-chip ram this area can be accessed from both the ram area and flash memory area figure 21.18 example of ram overlap operation example in which flash memory block area eb0 is overlapped 1. set bits rams and ram2 to ram0 in ramer to 1, 0, 0, 0, to overlap part of ram onto the area (eb0) for which real-time programming is required. 2. real-time programming is performed using the overlapping ram. 3. after the program data has been confirmed, the rams bit is cleared, releasing ram overlap. 4. the data written in the overlapping ram is written into the flash memory space (eb0). notes: 1. when the rams bit is set to 1, program/erase protection is enabled for all blocks regardless of the value of ram2 to ram0 (emulation protection). in this state, setting the p1 or e1 bit in flash memory control register 1 (flmcr1) will not cause a transition to program mode or erase mode. when actually programming or erasing a flash memory area, the rams bit should be cleared to 0. 2. a ram area cannot be erased by execution of software in accordance with the erase algorithm while flash memory emulation in ram is being used.
772 21.10 note on flash memory programming/erasing in the on-board programming modes (user mode and user program mode), nmi input should be disabled to give top priority to the program/erase operations (including ram emulation). when reading flash memory after changing the swe1 bit from 1 to 0 on completion of a program/erase operation, wait for at least t cswe after clearing swe1 to 0 before executing the flash memory read. regarding the timing of res input after changing the swe1 bit from 1 to 0 on completion of a program/erase operation, wait for at least t cswe after clearing swe1 to 0 before executing the reset operation. 21.11 flash memory programmer mode programs and data can be written and erased in programmer mode as well as in the on-board programming modes. in programmer mode, flash memory read mode, auto-program mode, auto- erase mode, and status read mode are supported. in auto-program mode, auto-erase mode, and status read mode, a status polling procedure is used, and in status read mode, detailed internal signals are output after execution of an auto-program or auto-erase operation. in programmer mode, set the mode pins to programmer mode (see table 21.12) and input a 6 mhz input clock, so that the sh7054f runs at 24 mhz. table 21.12 shows the pin settings for programmer mode. for the pin names in programmer mode, see section 1.3.2, pin functions. table 21.12 prom mode pin settings pin names settings mode pins: md2, md1, md0 0, 1, 1 fwe pin high level input (in auto-program and auto-erase modes) res
773 21.11.1 socket adapter pin correspondence diagram connect the socket adapter to the chip as shown in figure 21.20. this will enable conversion to a 40-pin arrangement. the on-chip rom memory map is shown in figure 21.19, and the socket adapter pin correspondence diagram in figure 21.20. h '00000000 a ddresses in m cu mode addresses in programmer mode h '0005ffff h'00000 h'5ffff on-chip rom space 384 kb figure 21.19 on-chip rom memory map
774 sh7054f socket adapter (conversion to 40-pin arrangement) pin no. pin name 188 189 190 191 192 193 195 197 198 199 200 201 202 203 204 206 208 1 2 35 36 37 38 39 40 41 43 119 121 120 28 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 d0 d1 d2 d3 d4 d5 d6 d7 ce oe we ce oe we res ce oe we figure 21.20 socket adapter pin correspondence diagram
775 21.11.2 programmer mode operation table 21.13 shows how the different operating modes are set when using programmer mode, and table 21.14 lists the commands used in programmer mode. details of each mode are given below. ? memory read mode memory read mode supports byte reads. ? auto-program mode auto-program mode supports programming of 128 bytes at a time. status polling is used to confirm the end of auto-programming. ? auto-erase mode auto-erase mode supports automatic erasing of the entire flash memory. status polling is used to confirm the end of auto-programming. ? status read mode status polling is used for auto-programming and auto-erasing, and normal termination can be confirmed by reading the i/o6 signal. in status read mode, error information is output if an error occurs. table 21.13 settings for various operating modes in programmer mode pin names mode fwe ce oe we i/o7 to i/o0 a18 to a0 read h or l l l h data output ain output disable h or l l h h hi-z x command write h or l l h l data input * ain chip disable h or l h x x hi-z x notes: 1. chip disable is not a standby state; internally, it is an operation state. 2. * ain indicates that there is also address input in auto-program mode. 3. for command writes in auto-program and auto-erase modes, input a high level to the fwe pin.
776 table 21.14 programmer mode commands number 1st cycle 2nd cycle command name of cycles mode address data mode address data memory read mode 1 + n write x h'00 read ra dout auto-program mode 129 write x h'40 write wa din auto-erase mode 2 write x h'20 write x h'20 status read mode 2 write x h'71 write x h'71 notes: 1. in auto-program mode, 129 cycles are required for command writing by a simultaneous 128-byte write. 2. in memory read mode, the number of cycles depends on the number of address write cycles (n). 21.11.3 memory read mode 1. after completion of auto-program/auto-erase/status read operations, a transition is made to the command wait state. when reading memory contents, a transition to memory read mode must first be made with a command write, after which the memory contents are read. 2. in memory read mode, command writes can be performed in the same way as in the command wait state. 3. once memory read mode has been entered, consecutive reads can be performed. 4. after powering on, memory read mode is entered. table 21.15 ac characteristics in transition to memory read mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce ce we we
777 ce oe ce oe we we figure 21.21 timing waveforms for memory read after memory write table 21.16 ac characteristics in transition from memory read mode to another mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce ce we we
778 ce oe we we oe figure 21.22 timing waveforms in transition from memory read mode to another mode table 21.17 ac characteristics in memory read mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes access time t acc 20 ? ce oe ce oe we figure 21.23 ce and oe enable state read timing waveforms
779 ce oe we figure 21.24 ce and oe clock system read timing waveforms 21.11.4 auto-program mode 1. in auto-program mode, 128 bytes are programmed simultaneously. this should be carried out by executing 128 consecutive byte transfers. 2. a 128-byte data transfer is necessary even when programming fewer than 128 bytes. in this case, h'ff data must be written to the extra addresses. 3. the lower 7 bits of the transfer address must be low. if a value other than an effective address is input, processing will switch to a memory write operation but a write error will be flagged. 4. memory address transfer is performed in the second cycle (figure 21.25). do not perform transfer after the second cycle. 5. do not perform a command write during a programming operation. 6. perform one auto-program operation for a 128-byte block for each address. two or more additional programming operations cannot be performed on a previously programmed address block. 7. confirm normal end of auto-programming by checking i/o6. alternatively, status read mode can also be used for this purpose (i/o7 status polling uses the auto-program operation end decision pin). 8. status polling i/o6 and i/o7 pin information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe .
780 table 21.18 ac characteristics in auto-program mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce ce we we ce oe we figure 21.25 auto-program mode timing waveforms
781 21.11.5 auto-erase mode 1. auto-erase mode supports only entire memory erasing. 2. do not perform a command write during auto-erasing. 3. confirm normal end of auto-erasing by checking i/o6. alternatively, status read mode can also be used for this purpose (i/o7 status polling uses the auto-erase operation end decision pin). 4. status polling i/o6 and i/o7 pin information is retained until the next command write. as long as the next command write has not been performed, reading is possible by enabling ce and oe . table 21.19 ac characteristics in auto-erase mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes command write cycle t nxtc 20 ? ce ce we we
782 ce oe we erase end decision signal erase normal end decision signal figure 21.26 auto-erase mode timing waveforms
783 21.11.6 status read mode 1. status read mode is provided to identify the kind of abnormal end. use this mode when an abnormal end occurs in auto-program mode or auto-erase mode. 2. the return code is retained until a command write other than a status read mode command write is executed. table 21.20 ac characteristics in status read mode (conditions: v cc = 3.3 v ?.3 v, v ss = 0 v, t a = 25? ??) item symbol min max unit notes read time after command write t nxtc 20 ? ce ce oe ce we we ce oe we t wep t f t r h'71 note: i/o2 and i/o3 are undefined. figure 21.27 status read mode timing waveforms
784 table 21.21 status read mode return commands pin name i/o7 i/o6 i/o5 i/o4 i/o3 i/o2 i/o1 i/o0 attribute normal end decision command error program- ming error erase error program- ming or erase count exceeded effective address error initial value 00000000 indications normal end: 0 abnormal end: 1 command error: 1 otherwise: 0 program- ming error: 1 otherwise: 0 erasing error: 1 otherwise: 0 count exceeded: 1 otherwise: 0 effective address error: 1 otherwise: 0 note: i/o2 and i/o3 are undefined. 21.11.7 status polling 1. the i/o7 status polling flag indicates the operating status in auto-program/auto-erase mode. 2. the i/o6 status polling flag indicates a normal or abnormal end in auto-program/auto-erase mode. table 21.22 status polling output truth table pin name during internal operation abnormal end normal end i/o7 0101 i/o6 0011 i/o0 to i/o5 0000 21.11.8 programmer mode transition time commands cannot be accepted during the oscillation stabilization period or the programmer mode setup period. after the programmer mode setup time, a transition is made to memory read mode. table 21.23 stipulated transition times to command wait state item symbol min max unit notes standby release (oscillation stabilization time) t osc1 30 ms programmer mode setup time t bmv 10 ms v cc hold time t dwn 0ms
785 t osc1 t bmv t dwn v cc res figure 21.28 oscillation stabilization time, boot program transfer time, and power-down sequence 21.11.9 notes on memory programming 1. when programming addresses which have previously been programmed, carry out auto- erasing before auto-programming. 2. when performing programming using programmer mode on a chip that has been programmed/erased in an on-board programming mode, auto-erasing is recommended before carrying out auto-programming. notes: 1. the flash memory is initially in the erased state when the device is shipped by hitachi. for other chips for which the erasure history is unknown, it is recommended that auto- erasing be executed to check and supplement the initialization (erase) level. 2. auto-programming should be performed once only on the same address block. additional programming cannot be performed on previously programmed address blocks.
786
787 section 22 ram 22.1 overview the sh7052f has 12 kbytes of on-chip ram, sh7053f and sh7054f each have 16 kbytes, of on-chip ram. the on-chip ram is linked to the cpu, direct memory access controller (dmac), and advanced user debugger (aud) with a 32-bit data bus (figure 22.1). the cpu, dmac, and aud can access data in the on-chip ram in 8, 16, or 32 bit widths. on- chip ram data can always be accessed in one state, making the ram ideal for use as a program area, stack area, or data area, which require high-speed access. the contents of the on-chip ram are held in both the sleep and software standby modes. when the rame bit (see below) is cleared to 0, the on-chip ram contents are also held in hardware standby mode. the on-chip ram of sh7052f is allocated to addresses h'ffff8000 to h'ffffafff.each on- chip ram of sh7053f and sh7054f is allocated to address h'ffff8000 to h'ffffbfff
788 h'ffffaffc h'ffffaffd h'ffffaffe h'ffffafff h'ffff6004 h'ffff6005 h'ffff6006 h'ffff6007 h'ffff8000 h'ffff8001 h'ffff8002 h'ffff8003 on-chip ram 8 bit 8 bit 8 bit 8 bit internal data bus (32 bit) 8 bit 8 bit 8 bit 8 bit internal data bus (32 bit) sh7052f h'ffffbffc h'ffffbffd h'ffffbffe h'ffffbfff h'ffff6004 h'ffff6005 h'ffff6006 h'ffff6007 h'ffff8000 h'ffff8001 h'ffff8002 h'ffff8003 sh7053f/7054f on-chip ram figure 22.1 block diagram of ram
789 22.2 operation the on-chip ram is controlled by means of the system control register (syscr). when the rame bit in syscr is set to 1, the on-chip ram is enabled. accesses to addresses h'ffff8000 to h'ffffafff is sh7052f, or accesses to address h'ffff8000 to h'ffffbfff in sh7053f and sh7054f are then directed to the on-chip ram. when the rame bit in syscr is cleared to 0, the on-chip ram is not accessed. a read will return an undefined value, and a write is invalid. if a transition is made to hardware standby mode after the rame bit in syscr is cleared to 0, the contents of the on-chip ram are held. for details of syscr, see 23.2.2, system control register (syscr), in section 23, power-down state.
790
791 section 23 power-down state 23.1 overview three modes are provided as power-save modes, namely, the hardware standby, software standby and sleep modes. also, a module stop function is available to stop some modules. these standby modes can be selected depending on applications to reduce the power consumption of the sh7052f/sh7053f/sh7054f. 23.1.1 power-down states the power-down state is effected by the following modes: 1. hardware standby mode a transition to hardware standby mode is made according to the input level of the res and hstby pins. in hardware standby mode, all sh7052f/sh7053f/sh7054f functions are halted. this state is exited by means of a power-on reset. 2. software standby mode a transition to software standby mode is made by means of software (a cpu instruction). in software standby mode, all sh7052f/sh7053f/sh7054f functions are halted. this state is exited by means of a power-on reset or an nmi interrupt. 3. sleep mode a transition to sleep mode is made by means of a cpu instruction. in software standby mode, basically only the cpu is halted, and all on-chip peripheral modules operate. this state is exited by means of a power-on reset, a manual reset, interrupt, or dma address error. 4. module standby mode operation of the on-chip peripheral modules* which can be placed in a standby mode can be stopped by stopping the clock supply. clock supply to the individual modules can be controlled by setting bits in the module standby control register (mstcr). note: * aud, h-udi, and ubc
792 table 23.1 shows the transition conditions for entering the modes from the program execution state, as well as the cpu and peripheral function status in each mode and the procedures for canceling each mode. table 23.1 power-down state conditions state mode entering procedure clock cpu cpu registers on-chip peripheral modules ram pins canceling procedure hardware standby low-level input at hstby * 2 initialized high-level input at hstby * 1 held held or high impe- dance * 3 ? ? ? ? ? ?
793 23.1.2 pin configuration pins related to power-down modes are shown in table 23.2. table 23.2 pin configuration pin name abbreviation i/o function hardware standby input pin hstby res 23.1.3 related registers table 23.3 shows the registers used for power-down state control. table 23.3 related registers initial address access name abbreviation r/w value write read size standby control register sbycr * 1 r/w h'1f h'ffffec14 8 system control register syscr * 1 r/w h'01 h'fffff708 8 module standby control register mstcr * 1 r/w h'01 h'fffff70a * 2 h'fffff70b * 3 8, 16 notes: 1. sbycr is accessed in three cycles, syscr and mstcr in four or five cycles. 2. write data in word units. data cannot be written in byte or longword units. 3. read data in byte units. values cannot be read correctly if data is read in word or longword units.
794 23.2 register descriptions 23.2.1 standby control register (sbycr) the standby control register (sbycr) is an 8-bit readable/writable register that sets the transition to standby mode, and the port state in standby mode. sbycr is initialized to h'1f by a power-on reset. bit: 7 6 5 4 3 2 1 0 ssby hiz initial value: 0 0 0 1 1 1 1 1 r/w: r/w r/w r r r r r r ? bit 7?oftware standby (ssby): specifies transition to software standby mode. the ssby bit cannot be set to 1 while the watchdog timer is running (when the timer enable bit (tme) in the wdt timer control/status register (tcsr) is set to 1). to enter software standby mode, always halt the wdt by clearing the tme bit to 0, then set the ssby bit. bit 7: ssby description 0 executing sleep instruction puts the sh7052f/sh7053f/sh7054f into sleep mode (initial value) 1 executing sleep instruction puts the sh7052f/sh7053f/sh7054f into standby mode ? bit 6?ort high impedance (hiz): in software standby mode, this bit selects whether to set i/o port pins to high impedance or hold the pin state. the hiz bit cannot be set to 1 when the tme bit of the wdt timer control/status register (tcsr) is set to 1. when making the i/o port pin state high impedance, always clear the tme bit to 0 before setting the hiz bit. bit 6: hiz description 0 pin states held in software standby mode (initial value) 1 pins go to high impedance in software standby mode ? bit 5?eserved: this bit always reads 0. the write value should always be 0. ? bits 4 to 0?eserved: these bits always read 1. the write value should always be 1.
795 23.2.2 system control register (syscr) bit: 7 6 5 4 3 2 1 0 ? ? ? ? ? ? audsrst rame initial value: 0 0 0 0 0 0 0 1 r/w: r r r r r r r/w r/w the system control register (syscr) is an 8-bit readable/writable register that performs aud software reset control and enables or disables access to the on-chip ram. syscr is initialized to h'01 by a power-on reset. ? bits 7 to 2?eserved: these bits always read 0. the write value should always be 0. ? bit1?aud software reset (audsrst): this bit controls aud reset using software. setting the audsrst bit to 1 places, the aud module in the power-on reset state. bit 1: audsrst description 0 aud reset state cleared 1 aud reset state entered (initial value) ? bit 0?ame enable (rame): selects enabling or disabling of the on-chip ram. when rame is set to 1, on-chip ram is enabled. when rame is cleared to 0, on-chip ram cannot be accessed. in this case, a read or instruction fetch from on-chip ram will return an undefined value, and a write to on-chip ram will be ignored. the initial value of rame is 1. when on-chip ram is disabled by clearing rame to 0, do not place an instruction that attempts to access on-chip ram immediately after the syscr write instruction, as normal access cannot be guaranteed in this case. when on-chip ram is enabled by setting rame to 1, place an syscr read instruction immediately after the syscr write instruction. normal access cannot be guaranteed if an on- chip ram access instruction is placed immediately after the syscr write instruction. bit 0: rame description 0 on-chip ram disabled 1 on-chip ram enabled (initial value)
796 23.2.3 module standby control register (mstcr) bit: 7 6 5 4 3 2 1 0 ? ? ? ? mstop3 ?? the module standby control register (mstcr) is an 8-bit readable/writable register that controls the standby state of the aud, and ubc on-chip modules. mstcr is initialized to h'01 by a power-on reset. note: the method of writing to mstcr is different from that of ordinary registers to prevent inadvertent rewriting. see section 23.2.4, notes on register access, for more information. ? bits 7 to 4?eserved: these bits always read 0. the write value should always be 0. ? bit 3?odule stop 3 (mstop3): specifies halting of the clock supply to the aud on-chip peripheral module. setting the mstop3 bit to 1 stops the clock supply to the aud. to cancel halting of the clock supply to the aud, first set the aud software reset bit (audsrst) in the system control register (syscr) to the aud reset state value. use of the aud will then be enabled by clearing the aud reset. bit 3: mstop3 description 0 aud operates (initial value) 1 clock supply to aud stopped ? bits 2 and 1?eserved: these bits always read 0. the write value should always be 0. ? bit 0?odule stop 0 (mstop0): specifies halting of the clock supply stop to the ubc on- chip peripheral module. clearing the mstop0 bit to 0 starts the clock supply to the ubc. stopping clock supply to the ubc will reset the internal state of the ubc including its registers. bit 0: mstop0 description 0 ubc operates 1 clock supply to ubc stopped (initial value)
797 23.2.4 notes on register access the method of writing to the module standby control register (mstcr) is different from that of ordinary registers to prevent inadvertent rewriting. be certain to use a word transfer instruction when writing data to mstcr. data cannot be written by a byte transfer instruction. as shown in figure 23.1, set the upper byte to h'3c and transfer data using the lower byte as write data. data can be read by the same method as for ordinary registers. mstcr is allocated to address h'fffff70a. always use a byte transfer instruction to read data. 15 8 7 0 h'3c write data address: when writing to mstcr h'fffff70a figure 23.1 writing to mstcr 23.3 hardware standby mode 23.3.1 transition to hardware standby mode the chip enters hardware standby mode when the hstby pin or res pin goes low. hardware standby mode reduces power consumption drastically by halting all sh7052f/sh7053f/sh7054f functions. as the transition to hardware standby mode is made by means of external pin input, the transition is made asynchronously, regardless of the current state of the sh7052f/sh7053f/sh7054f, and therefore the chip state prior to the transition is not preserved. however, on-chip ram data is retained as long as the specified voltage is supplied. to retain on- chip ram data, clear the ram enable bit (rame) to 0 in the system control register (syscr) before driving the hstby pin low. see appendix b pin states for the pin states in hardware standby mode. 23.3.2 canceling hardware standby mode hardware standby mode is canceled by means of the hstby pin and res pin. when hstby is driven high while res is low, the clock oscillator starts running. the res pin should be held low long enough for clock oscillation to stabilize. when res is driven high, power-on reset exception processing is started and a transition is made to the program execution state.
798 23.3.3 hardware standby mode timing figure 23.2 shows sample pin timings for hardware standby mode. a transition to hardware standby mode is made by driving the hstby pin low after driving the res pin low. hardware standby mode is canceled by driving hstby high, waiting for clock oscillation to stabilize, then switching res from low to high. oscillator res hstby res pulse width t resw oscillation settling time reset exception processing figure 23.2 hardware standby mode timing 23.4 software standby mode 23.4.1 transition to software standby mode to enter software standby mode, set the software standby bit (ssby) to 1 in sbycr, then execute the sleep instruction. the sh7052f/sh7053f/sh7054f switches from the program execution state to software standby mode. in software standby mode, power consumption is greatly reduced by halting not only the cpu, but the clock and on-chip peripheral modules as well. cpu register contents and on-chip ram data are held as long as the prescribed voltages are applied (when the rame bit in syscr is 0). the register contents of some on-chip peripheral modules are initialized, but some are not (table 23.4). the i/o port state can be selected as held or high impedance by the port high impedance bit (hiz) in sbycr. for other pin states, refer to appendix b pin states.
799 table 23.4 register states in software standby mode on-chip peripheral module registers initialized registers that retain data interrupt controller (intc) ? all registers user break controller (ubc) ? all registers bus state controller (bsc) ? all registers direct memory access controller (dmac) all registers ? advanced timer unit (atu) all registers ? advanced pulse controller (apc) ? all registers watchdog timer (wdt) ? bits 7 to 5 (ovf, wt/ it , tme) of the timer control status register (tcsr) ? reset control/status register (rstcsr) ? timer counter (tcnt) ? bits 2 to 0 (cks2 to cks0) of tcsr compare match timer (cmt) all registers ? hcan registers other than mc0[1:8] to mc15[1:8] md0[1:8] to md15[1:8] mc0[1:8] to mc15[1:8] md0[1:8] to md15[1:8] serial communication interface (sci) all registers ? a/d converter (a/d) all registers ? pin function controller (pfc) ? all registers i/o ports (i/o) ? all registers flash memory control registers all registers (except ramer) ? power-down state related ? ? standby control register (sbycr) ? system control register (syscr) ? module stop control register (mstcr)
800 23.4.2 canceling software standby mode software standby mode is canceled by an nmi interrupt or a power-on reset. cancellation by nmi: clock oscillation starts when a rising edge or falling edge (selected by the nmi edge select bit (nmie) in the interrupt control register (icr) of the intc) is detected in the nmi signal. this clock is supplied only to the watchdog timer (wdt). a wdt overflow occurs if the time established by the clock select bits (cks2 to cks0) in tcsr of the wdt elapses before transition to software standby mode. the occurrence of this overflow is used to indicate that the clock has stabilized, so the clock is supplied to the entire chip, software standby mode is canceled, and nmi exception processing begins. when canceling standby mode with an nmi interrupt, set the cks2 to cks0 bits so that the wdt overflow period is longer than the oscillation stabilization time. when canceling standby mode with an nmi pin set for falling edge, be sure that the nmi pin level upon entering software standby (when the clock is halted) is high, and that the nmi pin level upon returning from software standby (when the clock starts after oscillation stabilization) is low. when canceling software standby mode with an nmi pin set for rising edge, be sure that the nmi pin level upon entering software standby (when the clock is halted) is low, and that the nmi pin level upon returning from software standby (when the clock starts after oscillation stabilization) is high. cancellation by power-on reset: a power-on reset of the sh7052f/sh7053f/sh7054f caused by driving the res pin low cancels software standby mode.
801 23.4.3 software standby mode application example this example describes a transition to software standby mode on the falling edge of the nmi signal, and cancellation on the rising edge of the nmi signal. the timing is shown in figure 23.3. when the nmi pin is changed from high to low level while the nmi edge select bit (nmie) in icr is set to 0 (falling edge detection), the nmi interrupt is accepted. when the nmie bit is set to 1 (rising edge detection) by the nmi exception service routine, the software standby bit (ssby) in sbycr is set to 1, and a sleep instruction is executed, software standby mode is entered. thereafter, software standby mode is canceled when the nmi pin is changed from low to high level. oscillator ck nmi pin nmie bit ssby bit sh7055 state oscillation start time program execution exception service routine software standby mode wdt set time nmi exception processing nmi exception processing oscillation settling time figure 23.3 software standby mode nmi timing (application example)
802 23.5 sleep mode 23.5.1 transition to sleep mode executing the sleep instruction after the software standby bit (ssby) in sbycr has been cleared to 0 causes a transition from the program execution state to sleep mode. although the cpu halts immediately after executing the sleep instruction, the contents of its internal registers remain unchanged. the on-chip peripheral modules continue to run during sleep mode. 23.5.2 canceling sleep mode cancellation by interrupt: when an interrupt occurs, sleep mode is canceled and interrupt exception processing is executed. the sleep mode is not canceled if the interrupt cannot be accepted because its priority level is equal to or less than the mask level set in the cpu? status register (sr) or if an interrupt by an on-chip peripheral module is disabled at the peripheral module. cancellation by dma address error: if a dma address error occurs, sleep mode is canceled and dma address error exception processing is executed. cancellation by manual reset: when an internal manual reset is triggered by the wdt and the cpu acquires the bus during the internal manual reset period, the state of the sh7052f/sh7053f/sh7054f changes to the manual reset state and sleep mode will be released. cancellation by power-on reset: a power-on reset of the sh7052f/sh7053f/sh7054f resulting from driving the res pin low, or caused by the wdt, cancels sleep mode.
803 section 24 electrical characteristics 24.1 absolute maximum ratings table 24.1 shows the absolute maximum ratings. table 24.1 absolute maximum ratings item symbol rating unit remarks power supply voltage v cc , pllv cc v cc e0.3 to +4.3 v the pllcap, extal, xtal, and ck pins are concerned. (the same voltage must be used for v cc and pllv cc ) pv cc 1, pv cc 2pv cc e0.3 to +7.0 v except for the pllcap, extal, xtal, and ck pins and the analog input pin input voltage extal vin e0.3 to v cc + 0.3 v all pins other than the analog input pin and extal pin vin e0.3 to pv cc + 0.3 v refer to table 24.2 analog power supply voltage av cc e0.3 to +7.0 v analog reference voltage avref e0.3 to av cc + 0.3 v analog input voltage v an e0.3 to av cc + 0.3 v operating temperature (except when writing or erasing flash eeprom) topr e40 to +85 [operating precautions] operating the lsi in excess of the absolute maximum ratings may result in permanent damage. the two power supply voltages of pv cc of 5v and v cc of 3v may be used simultaneously with the lsi. be sure to use the lsi in compliance with the connection of power pins, combination conditions of applicable power supply voltages, voltage applicable to each pin, and conditions of output voltage, as specified in the manual. connecting a non-specified power supply or using the lsi at an incorrect voltage may result in permanent damage of the lsi or the system that contains the lsi.
804 24.2 dc characteristics table 24.2 shows the correspondence between power supply names and pins. table 24.4 shows dc characteristics. table 24.2 correspondence between power supply names and pins power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 1 pf1 a17 pvcc1 pvcc1+0.3 2 pf2 a18 pvcc1 pvcc1+0.3 3 pf3 a19 pvcc1 pvcc1+0.3 4 pf4 a20 pvcc1 pvcc1+0.3 5 pf5 a21 pod wrl wrh wait rd cs0 cs1 cs2 cs3 back breq
805 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 25 vss 26 xtal vcc 27 vcc 28 fwe 5.5+0.3 29 hstby res
806 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 52 ph15 d15 pvcc1 pvcc1+0.3 53 avcc 54 avref 55 avss 56 an0 avcc+0.3 57 an1 avcc+0.3 58 an2 avcc+0.3 59 an3 avcc+0.3 60 an4 avcc+0.3 61 an5 avcc+0.3 62 an6 avcc+0.3 63 an7 avcc+0.3 64 an8 avcc+0.3 65 an9 avcc+0.3 66 an10 avcc+0.3 67 an11 avcc+0.3 68 an12 avcc+0.3 69 an13 avcc+0.3 70 an14 avcc+0.3 71 an15 avcc+0.3 72 wdtovf
807 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 77 pa2 ti0c pvcc2 pvcc2+0.3 schmitt- trigger input pin 78 pa3 ti0d pvcc2 pvcc2+0.3 schmitt- trigger input pin 79 vcc 80 pa4 tio3a pvcc2 pvcc2+0.3 schmitt- trigger input pin 81 vss 82 pa5 tio3b pvcc2 pvcc2+0.3 schmitt- trigger input pin 83 pa6 tio3c pvcc2 pvcc2+0.3 schmitt- trigger input pin 84 pa7 tio3d pvcc2 pvcc2+0.3 schmitt- trigger input pin 85 pa8 tio4a pvcc2 pvcc2+0.3 schmitt- trigger input pin 86 pa9 tio4b pvcc2 pvcc2+0.3 schmitt- trigger input pin 87 pa10 tio4c pvcc2 pvcc2+0.3 schmitt- trigger input pin 88 pa11 tio4d pvcc2 pvcc2+0.3 schmitt- trigger input pin 89 pa12 tio5a pvcc2 pvcc2+0.3 schmitt- trigger input pin
808 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 90 pa13 tio5b pvcc2 pvcc2+0.3 schmitt- trigger input pin 91 pa14 txd0 pvcc2 pvcc2+0.3 92 pa15 rxd0 pvcc2 pvcc2+0.3 93 pb0 to6a pvcc2 pvcc2+0.3 94 pb1 to6b pvcc2 pvcc2+0.3 95 pvcc2 96 pb2 to6c pvcc2 pvcc2+0.3 97 vss 98 pb3 to6d pvcc2 pvcc2+0.3 99 pb4 to7a to8a pvcc2 pvcc2+0.3 100 pb5 to7b to8b pvcc2 pvcc2+0.3 101 pb6 to7c to8c pvcc2 pvcc2+0.3 102 pb7 to7d to8d pvcc2 pvcc2+0.3 103 pb8 txd3 to8e pvcc2 pvcc2+0.3 104 pb9 rxd3 to8f pvcc2 pvcc2+0.3 105 pb10 txd4 htxd to8g pvcc2 pvcc2+0.3 106 pb11 rxd4 hrxd to8h pvcc2 pvcc2+0.3 107 pb12 tclka ubctrg
809 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 111 pc0 txd1 pvcc2 pvcc2+0.3 112 pc1 rxd1 pvcc2 pvcc2+0.3 113 pc2 txd2 pvcc2 pvcc2+0.3 114 pc3 rxd2 pvcc2 pvcc2+0.3 115 pvcc2 116 pc4 irq0 irq1 irq2 irq3 adtrg0
810 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 128 pj4 tio2e pvcc2 pvcc2+0.3 schmitt- trigger input pin 129 pj5 tio2f pvcc2 pvcc2+0.3 schmitt- trigger input pin 130 pj6 tio2g pvcc2 pvcc2+0.3 schmitt- trigger input pin 131 vcc 132 pj7 tio2h pvcc2 pvcc2+0.3 schmitt- trigger input pin 133 vss 134 pj8 tio5c pvcc2 pvcc2+0.3 schmitt- trigger input pin 135 pj9 tio5d pvcc2 pvcc2+0.3 schmitt- trigger input pin 136 pj10 ti9a pvcc2 pvcc2+0.3 schmitt- trigger input pin 137 pj11 ti9b pvcc2 pvcc2+0.3 schmitt- trigger input pin 138 pj12 ti9c pvcc2 pvcc2+0.3 schmitt- trigger input pin 139 pj13 ti9d pvcc2 pvcc2+0.3 schmitt- trigger input pin 140 pj14 ti9e pvcc2 pvcc2+0.3 schmitt- trigger input pin
811 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 141 pvcc2 142 pj15 ti9f pvcc2 pvcc2+0.3 schmitt- trigger input pin 143 vss 144 pk0 to8a pvcc2 pvcc2+0.3 145 pk1 to8b pvcc2 pvcc2+0.3 146 pk2 to8c pvcc2 pvcc2+0.3 147 pk3 to8d pvcc2 pvcc2+0.3 148 pk4 to8e pvcc2 pvcc2+0.3 149 pk5 to8f pvcc2 pvcc2+0.3 150 pk6 to8g pvcc2 pvcc2+0.3 151 pk7 to8h pvcc2 pvcc2+0.3 152 pk8 to8i pvcc2 pvcc2+0.3 153 pk9 to8j pvcc2 pvcc2+0.3 154 pk10 to8k pvcc2 pvcc2+0.3 155 pk11 to8l pvcc2 pvcc2+0.3 156 pk12 to8m pvcc2 pvcc2+0.3 157 pk13 to8n pvcc2 pvcc2+0.3 158 pvcc2 159 pk14 to8o pvcc2 pvcc2+0.3 160 vss 161 pk15 to8p pvcc2 pvcc2+0.3 162 audrst
812 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 168 audck pvcc2 pvcc2+0.3 169 audsync
813 table 24.2 correspondence between power supply names and pins (cont) power supply pin user pin output circuit input pin no. power supply name dedicated pin function 1 function 2 function 3 function 4 power supply name voltage upper limit (v) notes 185 vss 186 pd12 puls4 pvcc2 pvcc2+0.3 187 pd13 puls6 htxd pvcc2 pvcc2+0.3 188 pe0 a0 pvcc1 pvcc1+0.3 189 pe1 a1 pvcc1 pvcc1+0.3 190 pe2 a2 pvcc1 pvcc1+0.3 191 pe3 a3 pvcc1 pvcc1+0.3 192 pe4 a4 pvcc1 pvcc1+0.3 193 pe5 a5 pvcc1 pvcc1+0.3 194 pvcc1 195 pe6 a6 pvcc1 pvcc1+0.3 196 vss 197 pe7 a7 pvcc1 pvcc1+0.3 198 pe8 a8 pvcc1 pvcc1+0.3 199 pe9 a9 pvcc1 pvcc1+0.3 200 pe10 a10 pvcc1 pvcc1+0.3 201 pe11 a11 pvcc1 pvcc1+0.3 202 pe12 a12 pvcc1 pvcc1+0.3 203 pe13 a13 pvcc1 pvcc1+0.3 204 pe14 a14 pvcc1 pvcc1+0.3 205 pvcc1 206 pe15 a15 pvcc1 pvcc1+0.3 207 vss 208 pf0 a16 pvcc1 pvcc1+0.3
814 usage notes set power supply voltages during lsi operation as shown below. v cc = pllv cc = 3.3 v ?.3 v, pv cc 1 = 5.0 v ?.5 v/3.3 v ?.3 v, pv cc 2 = 5.0 v ?.5 v, av cc = 5.0 v ?.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v when pv cc 1 = 3.3 v ?.3 v, v cc = pv cc 1 the pv cc 1 power supply voltage depends on the operating mode as shown below. operation cannot be guaranteed with other pv cc 1 power supply voltages. table 24.3 pv cc 1 voltage in each operating mode operating mode no. mode name pv cc 1 voltage modes 0, 1, 2 mcu expanded mode 3.3 v 0.3 v mode 3 single-chip mode 5.0 v 0.5 v mode 4 boot mode 3.3 v 0.3 v mode 5 boot mode 5.0 v 0.5 v mode 6 user program mode 3.3 v 0.3 v mode 7 user program mode 5.0 v 0.5 v
815 table 24.4 dc characteristics conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min typ max unit measurement conditions input high- level voltage (except schmitt trigger input voltage) res hstby wait breq audrst res hstby audrst
816 table 24.4 dc characteristics (cont) conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min typ max unit measurement conditions schmitt trigger input voltage ti0a to ti0d, tio1a to tio1h, tio2a to tio2h, tio3a to tio3d, tio4a to tio4d, tio5a to tio5d, ti9a to ti9f, ti10, tclka, tclkb, adtrg0 irq0 irq3 res hstby audsync audrst
817 table 24.4 dc characteristics (cont) conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min typ max unit measurement conditions input leak current d15 to d0, wait breq audsync audrst cs3 cs0 wrh wrl rd back cs3 cs0 wrh wrl rd back
818 table 24.4 dc characteristics (cont) conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min typ max unit measurement conditions output low- level voltage a21 to a0, d15 to d0, cs3 cs0 wrh wrl rd back res
819 table 24.4 dc characteristics (cont) conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min typ max unit measurement conditions reference power supply current during a/d conversions, awaiting a/d conversion alref ? 1. 1 5 ma av ref = 5 v standby ? 1. 15 a ram standby voltage v ram 2.0 ? ? v v cc [operating precautions] 1. when the a/d converter is not used (including during standby), do not leave the av cc , av ref , and av ss pins open. 2. the current consumption is measured when v ih min = v cc ?0.5 v/pv cc ?0.5 v, v il = 0.5 v, with all output pins unloaded. 3. the operation guaranteed voltage range of power supply pv cc 1 in mcu expansion mode is 3.3 v ?.3 v. do not use a voltage outside this range. 4. the operation guaranteed voltage range of power supply pv cc 1 in mcu single-chip mode is 5.0 v ?.5 v. do not use a voltage outside this range.
820 table 24.5 permitted output current values conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, ta = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min typ max unit output low-level permissible current (per pin) i ol ? ? 6.0 ma output low-level permissible current (total) [operating precautions] to assure lsi reliability, do not exceed the output values listed in this table.
821 24.3 ac characteristics 24.3.1 power-on/off timing table 24.6 power-on/off timing conditions: v cc = pllv cc = 3.3 v ?.3 v, pv cc 1 = 5.0 v ?.5 v/3.3 v ?.3 v, pv cc 2 = 5.0 v ?.5 v, av cc = 5.0 v ?.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0? to 85?. when pv cc 1 = 3.3 v ?.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0? to 85?. item symbol min max unit figure v cc lead power-on time t vccs 0 ? ms figure 24.1 v cc hold time from pv cc cut-off t vcch 0?ms t vcch t vccs v cc pllv cc pv cc 2 pv cc 1 pv cc min pv cc min v cc min v cc min figure 24.1 power-on/off timing
822 24.3.2 clock timing table 24.7 shows the clock timing. table 24.7 clock timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures operating frequency f op 20 40 mhz figure 24.2 clock cycle time t cyc 25 50 ns clock low-level pulse width t cl 4 ? ns clock high-level pulse width t ch 4 ? ns clock rise time t cr ? 8ns clock fall time t cf ? 8ns extal clock input frequency f ex 5 10 mhz figure 24.3 extal clock input cycle time t ex cyc 100 200 ns extal clock input low-level pulse width t exl 30 ? ns extal clock input high-level pulse width t exh 30 ? ns extal clock input rise time t exr ? 8ns extal clock input fall time t exf ? 8ns reset oscillation settling time t osc1 30 ? ms figure 24.4 standby return clock settling time t osc2 30 ? ms [operating precautions] the extal, xtal, and ck pins constitute a circuit requiring a power supply voltage of v cc = 3.3 v 0.3 v. comply with the input and output voltages specified in the dc characteristics.
823 t cyc t ch t cf t cr v oh ck v oh 1/2v cc 1/2v cc v oh v ol v ol t cl note: ck pin is vcc = 3.3v 0.3v power supply circuit. figure 24.2 system clock timing t excyc t exh t exf t exr v ih extal v ih 1/2v cc 1/2v cc v ih v il v il t exl note: extal pin is vcc = 3.3v 0.3v power supply circuit. figure 24.3 extal clock input timing ck v cc pv cc2 pv cc1 v cc min pv cc min t osc1 v ih t osc1 t osc2 hstby res figure 24.4 oscillation settling time
824 24.3.3 control signal timing table 24.8 shows control signal timing. table 24.8 control signal timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures res pulse width t resw 20 ? t cyc figure 24.5 res setup time t ress 24 ? ns md2 to md0 setup time t mds 20 ? t cyc nmi setup time t nmis 24 ? ns figure 24.6 irq3 to irq0 setup time* 1 (edge detection) t irqes 24 ? ns irq3 to irq0 setup time* 1 (level detection) t irqls 24 ? ns nmi hold time t nmih 24 ? ns irq3 to irq0 hold time t irqeh 24 ? ns bus request setup time t brqs 24 ? ns figure 24.7 bus acknowledge delay time 1 t backd1 ? 30 ns bus acknowledge delay time 2 t backd2 ? 30 ns bus three-state delay time t bzd ? 30 ns [operating precautions] the operation guaranteed voltage range of power supply pv cc 1 in mcu expansion mode is 3.3 v ?.3 v. do not use a voltage outside this range. *1 the res , nmi and irq3 to irq0 signals are asynchronous inputs, but when the setup times shown here are provided, the signals are considered to have been changed at clock fall. if the setup times are not provided, recognition is delayed until the next clock rise or fall.
825 t ress t mds note: res pin is controlled by v il and v ih shown above. v oh v ih =v cc- 0.5v v ih =v cc- 0.5v v ih =v cc- 0.5v v il = 0.5v v il = 0.5v v il = 0.5v t ress t resw ck md2 to md0 res figure 24.5 reset input timing v ih = v cc -0.5v v ih = v cc -0.5v v il = 0.5v v il = 0.5v t nmis t nmih v ih v ol v ol v il v il t irqes t irqeh t irqls ck nmi irq edge irq level note: nmi pin is controlled by v il and v ih shown above. figure 24.6 interrupt signal input timing
826 t brqs t backd1 t brqs t bzd t bzd hi-z hi-z v ol v ol v ol v oh v oh v oh v oh v ih t backd2 ck breq (input) back (output) rd , csn , wrh , wrl a21 to a0, d15 to d0 figure 24.7 bus right release timing
827 24.3.4 bus timing table 24.9 shows bus timing. table 24.9 bus timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures address delay time t ad ? 35 ns figure 24.8, cs delay time 1 t csd1 ? 30 ns 24.9 cs delay time 2 t csd2 ? 30 ns read strobe delay time 1 t rsd1 ? 30 ns read strobe delay time 2 t rsd2 ? 30 ns read data setup time t rds 15 ? ns read data hold time t rdh 0 ? ns write strobe delay time 1 t wsd1 ? 30 ns write strobe delay time 2 t wsd2 ? 30 ns write data delay time t wdd ? 30 ns write data hold time t wdh t cyc m ? ns wait setup time t wts 15 ? ns figure 24.10 wait hold time t wth 0 ? ns read data access time t acc t cyc (n+1.5) e 39 ? ns figure 24.8, access time from read strobe t oe t cyc (n+1.0) e 39 ? ns 24.9 write address setup time t as 0 ? ns write address hold time t wr 5 ? ns n: number of waits m = 1: cs assertion extension cycle m = 0: ordinary cycle (cs assertion non-extension cycle) [operating precautions] the operation guaranteed voltage range of power supply pv cc 1 in mcu expansion mode is 3.3 v ?.3 v. do not use a voltage outside this range.
828 t 1 t ad v oh v ol t 2 t csd1 t rsd1 t oe t rsd2 t rds t acc t as t rdh t wsd2 t wr t wsd1 t csd2 t wdh t wdd note: t rdh : specified from the negate timing of a21 e a0, csn , or rd , whichever is first. ck a21 to a0 csn rd (read) wrx (write) d15 to d0 (read) d15 to d0 (write) figure 24.8 basic cycle (no waits)
829 t 1 t ad t w t 2 t csd1 v ol v oh t rsd1 t oe t rsd2 t rds t acc t as t rdh t wsd2 t wr t wsd1 t csd2 t wdh t wdd note: t rdh : specified from the negate timing of a21 e a0, csn , or rd , whichever is first. ck a21 to a0 csn rd (read) wrx (write) d15 to d0 (read) d15 to d0 (write) figure 24.9 basic cycle (one software wait)
830 t wth t wth t wts t wts ck a21 to a0 csn rd (read) d15 to d0 (read) d15 to d0 (write) wrx (write) wait t 1 t w t w t wo t 2 note: t rdh : specified from the nagate timinig of a21 e a0, csn , or rd , whichever is first. figure 24.10 basic cycle (two software waits + waits by wait signal)
831 24.3.5 advanced timer unit timing and advance pulse controller timing table 24.10 shows advanced timer unit timing and advanced pulse controller timing. table 24.10 advanced timer unit timing and advanced pulse controller timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures output compare output delay time t tocd ? 100 ns figure 24.11 input capture input setup time t tics 24* 1 24 + t cyc ? ns puls output delay time t plsd ? 100 ns timer clock input setup time t tcks 24* 1 24 + t cyc ? ns figure 24.12 timer clock pulse width (single edge specified) t tckwh/l 3.0 ? t cyc timer clock pulse width (both edges specified) t tckwh/l 5.0 ? t cyc [operating precautions] *1 the timer input signals and timer clock input signals are asynchronous, but judged to have been changed at clock rise with two-state intervals shown in figures 24.11 and 24.12. if the setup times shown here are not provided, recognition is delayed until the clock rise two states after that timing.
832 t tocd t 1 v oh v oh v oh v oh ck timer output input capture input puls output t tics *1 t plsd t n figure 24.11 atu input/output timing and apc output timing t 1 v oh t tcks t tckwl t tckwh v oh ck tclka, tclkb t n v oh v oh *1 t tcks *1 figure 24.12 atu input timing
833 24.3.6 i/o port timing table 24.11 shows i/o port timing. table 24.11 i/o port timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures port output data delay time t pwd ? 100 ns figure 24.13 port input hold time t prh 24* 1 24+tcyc ? ns port input setup time t prs 24* 1 24+tcyc ? ns [operating precautions] the operation guaranteed voltage range of power supply pv cc 1 in mcu single-chip mode is 5.0 v ?.5 v. do not use a voltage outside this range. *1 the port input signals are asynchronous, but judged to have been changed at ck clock rise with two-state intervals shown in figure 24.13. if the setup times shown here are not provided, recognition is delayed until the clock rise two states after that timing. t prs t prh t pwd ck port (read) port (write) figure 24.13 i/o port input/output timing
834 24.3.7 watchdog timer timing table 24.12 shows watchdog timer timing. table 24.12 watchdog timer timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures wdtovf delay time t wovd ? 100 ns figure 24.14 t wovd t wovd v oh v oh ck wdtovf figure 24.14 watchdog timer timing
835 24.3.8 serial communication interface timing table 24.13 shows serial communication interface timing. table 24.13 serial communication interface timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures clock cycle t scyc 8 ? t cyc figure 24.15 clock cycle (clock sync) t scyc 12 ? t cyc clock pulse width t sckw 0.4 0.6 t scyc input clock rise time t sckr ? 3.0 t cyc input clock fall time t sckf ? 3.0 t cyc transmit data delay time t txd ? 100 ns figure 24.16 receive data setup time t rxs 100 ? ns receive data hold time t rxh 100 ? ns [operating precautions] the inputs and outputs are asynchronous in start-stop synchronous mode, but as shown in figure 24.16, the receive data are judged to have been changed at ck clock rise (two-clock intervals). the transmit signals change with a reference of ck clock rise (two-clock intervals). t sckw v ih v ih v ih v ih v il v il v il sck0 to sck2 t sckr t sckf t scyc figure 24.15 sci input/output timing
836 t scyc sck0 to sck2 (input/output) txd0 to txd2 (transmit data) rxd0 to rxd2 (receive data) sci input/output timing (clock synchronous mode) t txd t rxs t rxh v oh v oh t1 ck txd0 to txd4 (trasmit data) rxd0 to rxd4 (receive data) sci input/output timing (start-stop synchronous mode) tn t txd t rxs t rxh figure 24.16 sci input/output timing
837 24.3.9 hcan timing table 24.14 shows hcan timing. table 24.14 hcan timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures transmit data delay time t htxd ? 100 ns figure 24.17 receive data setup time t hrxs 100 ? ns receive data hold time t hrxh 100 ? ns [operating precautions] the hcan input signals are asynchronous, but judged to have been changed at ck clock rise (two-clock intervals) shown in figure 24.17. the hcan output signals are asynchronous, but they change with a reference of ck clock rise (two-clock intervals) shown in figure 24.17. v oh v oh ck htxd (transmit data) hrxd (receive data) t htxd t hrxs t hrxh figure 24.17 hcan input/output timing
838 24.3.10 a/d converter timing table 24.15 shows a/d converter timing. table 24.15 a/d converter timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. csk = 0: fop = 20 to 40 mhz csk = 1: fop = 20 mhz item symbol min typ max min typ max unit figure external trigger input start delay time t trgs 50 ?? 50 ?? ns figure 24.18 a/d conversion time t conv 518 ? 532 262 ? 268 t cyc figure 24.19 a/d conversion start delay time t d 20 ? 34 12 ? 18 t cyc input sampling time t spl ? 128 ?? 64 t cyc ck adtrg input adcr (adst = 1 set) 4 to 6 states t trgs v oh figure 24.18 external trigger input timing
839 ck address analog input sampling signal adf t conv t d t spl (6 states) (up to 28 states) write cycle a/d synchronization time figure 24.19 analog conversion timing
840 24.3.11 aud timing table 24.16 shows aud timing. table 24.16 aud timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures audrst pulse width (branch trace mode) t audrstw 20 ? t cyc figure 24.20 audrst pulse width (ram monitor mode) t audrstw 5 ? t rmcyc audmd setup time (branch trace mode) t audmds 20 ? t cyc audmd setup time (ram monitor mode) t audmds 5 ? t rmcyc branch trace clock cycle t rtcyc 22 t cyc figure 24.21 branch trace clock duty t rtckw 40 60 % branch trace data delay time t rtdd ? 40 ns branch trace data hold time t rtdh 0 ? ns branch trace sync delay time t rtsd ? 40 ns branch trace sync hold time t rtsh 0 ? ns ram monitor clock cycle t rmcyc 100 ? ns figure 24.22 ram monitor clock low pulse width t rmckw 45 ? ns ram monitor output data delay time t rmdd 7t rmcyc e 20 ns ram monitor output data hold time t rmdhd 5 ? ns ram monitor input data setup time t rmds 20 ? ns ram monitor input data hold time t rmdh 5 ? ns ram monitor sync setup time t rmss 20 ? ns ram monitor sync hold time t rmsh 5 ? ns load conditions: audck (in branch trace): c l = 30 pf: other than above c l = 100 pf audsync , audata3 to audata0: c l = 100 pf
841 t rmcyc t audrstw t audmds t cyc ck audck (input) (ram monitor) audrst audmd (branch trace) figure 24.20 aud reset timing audck (output) audata3 to 0 (output) audsync (output) t btdd t btsd t btckw t btcyc t btdh t btsh figure 24.21 branch trace mode timing
842 audck (input) audata3 to 0 (output) audata3 to 0 (input) audsync (input) t rmdd t rmds t rmss t rmdh t rmcyc t rmckw t rmdhd t rmsh figure 24.22 ram monitor mode timing 24.3.12 ubc trigger timing table 24.17 shows ubc trigger timing. table 24.17 ubc trigger timing conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. item symbol min max unit figures ubctrg delay time t ubctgd ? 35 ns figure 24.23 v oh ck ubctrg t ubctgd figure 24.23 ubc trigger timing
843 24.3.13 measuring conditions for ac characteristics input reference levels high level: v ih min. value, low level: v il max. value output reference level high level: 2.0 v, low level: 0.8 v i ol i oh c l v ref v dut output lsi output pin c l is a total value that includes the measuring instrument capacitance. the following c l values are used: 30 pf: ck, cs3 to cs0 , breq , back , audck 50 pf: a21 to a0, d15 to d0, rd , wrh , wrl 100 pf: audata3 to 0, audsync 30 pf: all other port output pins and supporting module output pins i ol and i oh are the condition for the i ol = 1.6 ma, i oh = 200 a. figure 24.24 output test circuit
844 24.4 a/d converter characteristics table 24.18 shows a/d converter characteristics. table 24.18 a/d converter characteristics conditions: v cc = pllv cc = 3.3 v 0.3 v, pv cc 1 = 5.0 v 0.5 v/3.3 v 0.3 v, pv cc 2 = 5.0 v 0.5 v, av cc = 5.0 v 0.5 v, av ref = 4.5 v to av cc , v ss = pllv ss = av ss = 0 v, t a = ?0 c to 85 c. when pv cc 1 = 3.3 v 0.3 v, v cc = pv cc 1. when writing or erasing flash eeprom, t a = ?0 c to 85 c. csk = 0: fop = 20 to 40 mhz csk = 1: fop = 20 mhz item min typ max min typ max unit resolution 10 10 10 10 10 10 bit a/d conversion time ?? 13.3 ?? 13.4 s analog input capacitance ?? 20 ?? 20 pf permitted analog signal source impedance ?? 3 ?? 3k ? non-linear error ?? 1.5 ?? 1.5 lsb offset error ?? 1.5 ?? 1.5 lsb full-scale error ?? 1.5 ?? 1.5 lsb quantization error ?? 0.5 ?? 0.5 lsb absolute error ?? 2.0 ?? 2.0 lsb
845 appendix a on-chip supporting module registers a.1 address on-chip peripheral module register addresses and bit names are shown in the following table. 16-bit and 32-bit registers are shown in two and four rows of 8 bits, respectively. table a.1 address register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe400 mcr mcr7 ? mcr5 ? ? mcr2 mcr1 mcr0 hcan h'ffffe401 gsr ? ? ? ? gsr3 gsr2 gsr1 gsr0 h'ffffe402 bcr bcr7 bcr6 bcr5 bcr4 bcr3 bcr2 bcr1 bcr0 h'ffffe403 bcr15 bcr14 bcr13 bcr12 bcr11 bcr10 bcr9 bcr8 h'ffffe404 mbcr mbcr7 mbcr6 mbcr5 mbcr4 mbcr3 mbcr2 mbcr1 ? h'ffffe405 mbcr15 mbcr14 mbcr13 mbcr12 mbcr11 mbcr10 mbcr9 mbcr8 h'ffffe406 txpr txpr7 txpr6 txpr5 txpr4 txpr3 txpr2 txpr1 ? h'ffffe407 txpr15 txpr14 txpr13 txpr12 txpr11 txpr10 txpr9 txpr8 h'ffffe408 txcr txcr7 txcr6 txcr5 txcr4 txcr3 txcr2 txcr1 ? h'ffffe409 txcr15 txcr14 tcr13 txcr12 txcr11 tscr10 txcr9 txcr8 h'ffffe40a txack txack7 txack6 txack5 txack4 txack3 txack2 txack1 ? h'ffffe40b txack15 txack14 txack13 txack12 txack11 txack10 txack9 txack8 h'ffffe40c aback aback7 aback6 aback5 aback4 aback3 aback2 aback1 ? h'ffffe40d aback15 aback14 aback13 aback12 aback11 aback10 aback9 aback8 h'ffffe40e rxpr rxpr7 rxpr6 rxpr5 rxpr4 rxpr3 rxpr2 rxpr1 rxpr0 h'ffffe40f rxpr15 rxpr14 rxpr13 rxpr12 rxpr11 rxpr10 rxpr9 rxpr8 h'ffffe410 rfpr rfpr7 rfpr6 rfpr5 rfpr4 rfpr3 rfpr2 rfpr1 rfpr0 h'ffffe411 rfpr15 rfpr14 rfpr13 rfpr12 rfpr11 rfpr10 rfpr9 rfpr8 h'ffffe412 irr irr7 irr6 irr5 irr4 irr3 irr2 irr1 irr0 h'ffffe413 ? ? ? irr12 ? ? irr9 irr8 h'ffffe414 mbimr mbimr7 mbimr6 mbimr5 mbimr4 mbimr3 mbimr2 mbimr1 mbimr0 h'ffffe415 mbimr15 mbimr14 mbimr13 mbimr12 mbimr11 mbimr10 mbimr9 mbimr8 h'ffffe416 imr imr7 imr6 imr5 imr4 imr3 imr2 imr1 ? h'ffffe417 ? ? ? imr12 ? ? imr9 imr8
846 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe418 rec hcan h'ffffe419 tec h'ffffe41a umsr umsr7 umsr6 umsr5 umsr4 umsr3 umsr2 umsr1 umsr0 h'ffffe41b umsr15 umsr14 umsr13 umsr12 umsr11 umsr10 umsr9 umsr8 h'ffffe41c lafml lafml7 lafml6 lafml5 lafml4 lafml3 lafml2 lafml1 lafml0 h'ffffe41d lafml15 lafml14 lafml13 lafml12 lafml11 lafml10 lafml9 lafml8 h'ffffe41e lafmh lafmh7 lafmh6 lafmh5 ? ? ? lafmh1 lafmh0 h'ffffe41f lafmh15 lafmh14 lafmh13 lafmh12 lafmh11 lafmh10 lafmh9 lafmh8 h'ffffe420 mc0[1] dlc3 dlc2 dlc1 dlc0 h'ffffe421 mc0[2] h'ffffe422 mc0[3] h'ffffe423 mc0[4] h'ffffe424 mc0[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe425 mc0[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe426 mc0[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe427 mc0[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe428 mc1[1] dlc3 dlc2 dlc1 dlc0 h'ffffe429 mc1[2] h'ffffe42a mc1[3] h'ffffe42b mc1[4] h'ffffe42c mc1[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe42d mc1[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe42e mc1[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe42f mc1[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe430 mc2[1] dlc3 dlc2 dlc1 dlc0 h'ffffe431 mc2[2] h'ffffe432 mc2[3] h'ffffe433 mc2[4] h'ffffe434 mc2[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe435 mc2[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3
847 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe436 mc2[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 hcan h'ffffe437 mc2[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe438 mc3[1] dlc3 dlc2 dlc1 dlc0 h'ffffe439 mc3[2] h'ffffe43a mc3[3] h'ffffe43b mc3[4] h'ffffe43c mc3[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe43d mc3[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe43e mc3[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe43f mc3[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe440 mc4[1] dlc3 dlc2 dlc1 dlc0 h'ffffe441 mc4[2] h'ffffe442 mc4[3] h'ffffe443 mc4[4] h'ffffe444 mc4[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe445 mc4[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe446 mc4[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe447 mc4[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe448 mc5[1] dlc3 dlc2 dlc1 dlc0 h'ffffe449 mc5[2] h'ffffe44a mc5[3] h'ffffe44b mc5[4] h'ffffe44c mc5[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe44d mc5[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe44e mc5[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe44f mc5[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe450 mc6[1] dlc3 dlc2 dlc1 dlc0 h'ffffe451 mc6[2] h'ffffe452 mc6[3] h'ffffe453 mc6[4]
848 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe454 mc6[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 hcan h'ffffe455 mc6[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe456 mc6[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe457 mc6[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe458 mc7[1] dlc3 dlc2 dlc1 dlc0 h'ffffe459 mc7[2] h'ffffe45a mc7[3] h'ffffe45b mc7[4] h'ffffe45c mc7[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe45d mc7[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe45e mc7[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe45f mc7[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe460 mc8[1] dlc3 dlc2 dlc1 dlc0 h'ffffe461 mc8[2] h'ffffe462 mc8[3] h'ffffe463 mc8[4] h'ffffe464 mc8[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe465 mc8[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe466 mc8[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe467 mc8[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe468 mc9[1] dlc3 dlc2 dlc1 dlc0 h'ffffe469 mc9[2] h'ffffe46a mc9[3] h'ffffe46b mc9[4] h'ffffe46c mc9[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe46d mc9[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe46e mc9[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe46f mc9[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe470 mc10[1] dlc3 dlc2 dlc1 dlc0 h'ffffe471 mc10[2]
849 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe472 mc10[3] hcan h'ffffe473 mc10[4] h'ffffe474 mc10[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe475 mc10[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe476 mc10[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe477 mc10[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe478 mc11[1] dlc3 dlc2 dlc1 dlc0 h'ffffe479 mc11[2] h'ffffe47a mc11[3] h'ffffe47b mc11[4] h'ffffe47c mc11[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe47d mc11[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe47e mc11[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe47f mc11[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe480 mc12[1] dlc3 dlc2 dlc1 dlc0 h'ffffe481 mc12[2] h'ffffe482 mc12[3] h'ffffe483 mc12[4] h'ffffe484 mc12[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe485 mc12[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe486 mc12[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe487 mc12[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe488 mc13[1] dlc3 dlc2 dlc1 dlc0 h'ffffe489 mc13[2] h'ffffe48a mc13[3] h'ffffe48b mc13[4] h'ffffe48c mc13[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe48d mc13[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe48e mc13[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe48f mc13[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8
850 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe490 mc14[1] dlc3 dlc2 dlc1 dlc0 hcan h'ffffe491 mc14[2] h'ffffe492 mc14[3] h'ffffe493 mc14[4] h'ffffe494 mc14[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe495 mc14[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe496 mc14[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe497 mc14[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe498 mc15[1] dlc3 dlc2 dlc1 dlc0 h'ffffe499 mc15[2] h'ffffe49a mc15[3] h'ffffe49b mc15[4] h'ffffe49c mc15[5] std_id2 std_id1 std_id0 rtr ide exd_id17 exd_id16 h'ffffe49d mc15[6] std_id10 std_id9 std_id8 std_id7 std_id6 std_id5 std_id4 std_id3 h'ffffe49e mc15[7] exd_id7 exd_id6 exd_id5 exd_id4 exd_id3 exd_id2 exd_id1 exd_id0 h'ffffe49f mc15[8] exd_id15 exd_id14 exd_id13 exd_id12 exd_id11 exd_id10 exd_id9 exd_id8 h'ffffe4a0 to h'ffffe4af ? ? ?? ?? ?? ? h'ffffe4b0 md0[1] msg_data_1 h'ffffe4b1 md0[2] msg_data_2 h'ffffe4b2 md0[3] msg_data_3 h'ffffe4b3 md0[4] msg_data_4 h'ffffe4b4 md0[5] msg_data_5 h'ffffe4b5 md0[6] msg_data_6 h'ffffe4b6 md0[7] msg_data_7 h'ffffe4b7 md0[8] msg_data_8 h'ffffe4b8 md1[1] msg_data_1 h'ffffe4b9 md1[2] msg_data_2 h'ffffe4ba md1[3] msg_data_3 h'ffffe4bb md1[4] msg_data_4
851 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe4bc md1[5] msg_data_5 hcan h'ffffe4bd md1[6] msg_data_6 h'ffffe4be md1[7] msg_data_7 h'ffffe4bf md1[8] msg_data_8 h'ffffe4c0 md2[1] msg_data_1 h'ffffe4c1 md2[2] msg_data_2 h'ffffe4c2 md2[3] msg_data_3 h'ffffe4c3 md2[4] msg_data_4 h'ffffe4c4 md2[5] msg_data_5 h'ffffe4c5 md2[6] msg_data_6 h'ffffe4c6 md2[7] msg_data_7 h'ffffe4c7 md2[8] msg_data_8 h'ffffe4c8 md3[1] msg_data_1 h'ffffe4c9 md3[2] msg_data_2 h'ffffe4ca md3[3] msg_data_3 h'ffffe4cb md3[4] msg_data_4 h'ffffe4cc md3[5] msg_data_5 h'ffffe4cd md3[6] msg_data_6 h'ffffe4ce md3[7] msg_data_7 h'ffffe4cf md3[8] msg_data_8 h'ffffe4d0 md4[1] msg_data_1 h'ffffe4d1 md4[2] msg_data_2 h'ffffe4d2 md4[3] msg_data_3 h'ffffe4d3 md4[4] msg_data_4 h'ffffe4d4 md4[5] msg_data_5 h'ffffe4d5 md4[6] msg_data_6 h'ffffe4d6 md4[7] msg_data_7 h'ffffe4d7 md4[8] msg_data_8 h'ffffe4d8 md5[1] msg_data_1 h'ffffe4d9 md5[2] msg_data_2
852 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe4da md5[3] msg_data_3 hcan h'ffffe4db md5[4] msg_data_4 h'ffffe4dc md5[5] msg_data_5 h'ffffe4dd md5[6] msg_data_6 h'ffffe4de md5[7] msg_data_7 h'ffffe4df md5[8] msg_data_8 h'ffffe4e0 md6[1] msg_data_1 h'ffffe4e1 md6[2] msg_data_2 h'ffffe4e2 md6[3] msg_data_3 h'ffffe4e3 md6[4] msg_data_4 h'ffffe4e4 md6[5] msg_data_5 h'ffffe4e5 md6[6] msg_data_6 h'ffffe4e6 md6[7] msg_data_7 h'ffffe4e7 md6[8] msg_data_8 h'ffffe4e8 md7[1] msg_data_1 h'ffffe4e9 md7[2] msg_data_2 h'ffffe4ea md7[3] msg_data_3 h'ffffe4eb md7[4] msg_data_4 h'ffffe4ec md7[5] msg_data_5 h'ffffe4ed md7[6] msg_data_6 h'ffffe4ee md7[7] msg_data_7 h'ffffe4ef md7[8] msg_data_8 h'ffffe4f0 md8[1] msg_data_1 h'ffffe4f1 md8[2] msg_data_2 h'ffffe4f2 md8[3] msg_data_3 h'ffffe4f3 md8[4] msg_data_4 h'ffffe4f4 md8[5] msg_data_5 h'ffffe4f5 md8[6] msg_data_6 h'ffffe4f6 md8[7] msg_data_7 h'ffffe4f7 md8[8] msg_data_8
853 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe4f8 md9[1] msg_data_1 hcan h'ffffe4f9 md9[2] msg_data_2 h'ffffe4fa md9[3] msg_data_3 h'ffffe4fb md9[4] msg_data_4 h'ffffe4fc md9[5] msg_data_5 h'ffffe4fd md9[6] msg_data_6 h'ffffe4fe md9[7] msg_data_7 h'ffffe4ff md9[8] msg_data_8 h'ffffe500 md10[1] msg_data_1 h'ffffe501 md10[2] msg_data_2 h'ffffe502 md10[3] msg_data_3 h'ffffe503 md10[4] msg_data_4 h'ffffe504 md10[5] msg_data_5 h'ffffe505 md10[6] msg_data_6 h'ffffe506 md10[7] msg_data_7 h'ffffe507 md10[8] msg_data_8 h'ffffe508 md11[1] msg_data_1 h'ffffe509 md11[2] msg_data_2 h'ffffe50a md11[3] msg_data_3 h'ffffe50b md11[4] msg_data_4 h'ffffe50c md11[5] msg_data_5 h'ffffe50d md11[6] msg_data_6 h'ffffe50e md11[7] msg_data_7 h'ffffe50f md11[8] msg_data_8 h'ffffe510 md12[1] msg_data_1 h'ffffe511 md12[2] msg_data_2 h'ffffe512 md12[3] msg_data_3 h'ffffe513 md12[4] msg_data_4 h'ffffe514 md12[5] msg_data_5 h'ffffe515 md12[6] msg_data_6
854 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe516 md12[7] msg_data_7 hcan h'ffffe517 md12[8] msg_data_8 h'ffffe518 md13[1] msg_data_1 h'ffffe519 md13[2] msg_data_2 h'ffffe51a md13[3] msg_data_3 h'ffffe51b md13[4] msg_data_4 h'ffffe51c md13[5] msg_data_5 h'ffffe51d md13[6] msg_data_6 h'ffffe51e md13[7] msg_data_7 h'ffffe51f md13[8] msg_data_8 h'ffffe520 md14[1] msg_data_1 h'ffffe521 md14[2] msg_data_2 h'ffffe522 md14[3] msg_data_3 h'ffffe523 md14[4] msg_data_4 h'ffffe524 md14[5] msg_data_5 h'ffffe525 md14[6] msg_data_6 h'ffffe526 md14[7] msg_data_7 h'ffffe527 md14[8] msg_data_8 h'ffffe528 md15[1] msg_data_1 h'ffffe529 md15[2] msg_data_2 h'ffffe52a md15[3] msg_data_3 h'ffffe52b md15[4] msg_data_4 h'ffffe52c md15[5] msg_data_5 h'ffffe52d md15[6] msg_data_6 h'ffffe52e md15[7] msg_data_7 h'ffffe52f md15[8] msg_data_8 h'ffffe530 to h'ffffe7ff ? ? ?? ?? ?? ?? h'ffffe800 flmcr1 fwe swe1 esu1 psu1 ev1 pv1 e1 p1 flash h'ffffe801 flmcr2 fler ? ? ? ? ? ? ?
855 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffe802 ebr1 eb7 eb6 eb5 eb4 eb3 eb2 eb1 eb0 flash h'ffffe803 ebr2 ? ? eb13 * 1 eb12 * 1 eb11 e10 eb9 eb8 h'ffffe804 to h'ffffebff ? ? ?? ?? ?? ?? h'ffffec00 ubarh uba31 uba30 uba29 uba28 uba27 uba26 uba25 uba24 ubc h'ffffec01 uba23 uba22 uba21 uba20 uba19 uba18 uba17 uba16 h'ffffec02 ubarl uba15 uba14 uba13 uba12 uba11 uba10 uba9 uba8 h'ffffec03 uba7 uba6 uba5 uba4 uba3 uba2 uba1 uba0 h'ffffec04 ubamrh ubm31 ubm30 ubm29 ubm28 ubm27 ubm26 ubm25 ubm24 h'ffffec05 ubm23 ubm22 ubm21 ubm20 ubm19 ubm18 ubm17 ubm16 h'ffffec06 ubamrl ubm15 ubm14 ubm13 ubm12 ubm11 ubm10 ubm9 ubm8 h'ffffec07 ubm7 ubm6 ubm5 ubm4 ubm3 ubm2 ubm1 ubm0 h'ffffec08 ubbr ? ? ? ? ? ? ? ? h'ffffec09 cp1 cp0 id1 id0 rw1 rw0 sz1 sz0 h'ffffec0a ubcr ? ? ? ? ? ? ? ? h'ffffec0b ? ? ? ? ? cks1 cks0 ubid h'ffffec0c to h'ffffec0f ? ? ?? ?? ?? ?? h'ffffec10 tcsr * 2 ovf wt/ it * 2 h'ffffec12 ? ? ? ? ? ? ? ? ? h'ffffec13 rstcsr * 2 wovf rste rsts ? ? ? ? ? h'ffffec14 sbycr ssby hiz ? ? ? ? ? ? power-down mode h'ffffec15 to h'ffffec1f ? ? ?? ?? ?? ?? notes: 1. register names differ between the sh7053f and the sh7054f. for details, see sections 20.5.4, erase block register 2 (ebr2), and 21.5.4, erase block register 2 (ebr2). 2. this is the read address. the write address is h?fffec10 for tcsr and tcnt, and h?ffffec12 for rstcsr. for details, see section 12.2.4, register access.
856 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffec20 bcr1 ? ? ? ? ? ? ? ? bsc h'ffffec21 ? ? ? ? a3sz a2sz a1sz a0sz h'ffffec22 bcr2 iw31 iw30 iw21 iw20 iw11 iw10 iw01 iw00 h'ffffec23 cw3 cw2 cw1 cw0 sw3 sw2 sw1 sw0 h'ffffec24 wcr w33 w32 w31 w30 w23 w22 w21 w20 h'ffffec25 w13 w12 w11 w10 w03 w02 w01 w00 h'ffffec26 ramer ? ? ? ? ? ? ? ? h'ffffec27 ? ? ? ? rams ram2 ram1 ram0 h'ffffec28 to h'ffffecaf ? ? ?? ?? ?? ?? h'ffffecb0 dmaor ? ? ? ? ? ? ? ? dmac h'ffffecb1 ? ? ? ? ? ae nmif dme (common) h'ffffecb2 to h'ffffecbf ? ? ?? ?? ?? ?? h'ffffecc0 sar0 dmac h'ffffecc1 (channel 0) h'ffffecc2 h'ffffecc3 h'ffffecc4 dar0 h'ffffecc5 h'ffffecc6 h'ffffecc7 h'ffffecc8 dmatcr0 ? ? ? ? ? ? ? ? h'ffffecc9 h'ffffecca h'ffffeccb h'ffffeccc chcr0 ? ? ? ? ? ? ? ? h'ffffeccd ? ? ? rs4 rs3 rs2 rs1 rs0 h'ffffecce ? ? sm1 sm0 ? ? dm1 dm0 h'ffffeccf ? ? ts1 ts0 tm ie te de
857 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffecd0 sar1 dmac h'ffffecd1 (channel 1) h'ffffecd2 h'ffffecd3 h'ffffecd4 dar1 h'ffffecd5 h'ffffecd6 h'ffffecd7 h'ffffecd8 dmatcr1 ? ? ? ? ? ? ? ? h'ffffecd9 h'ffffecda h'ffffecdb h'ffffecdc chcr1 ? ? ? ? ? ? ? ? h'ffffecdd ? ? ? rs4 rs3 rs2 rs1 rs0 h'ffffecde ? ? sm1 sm0 ? ? dm1 dm0 h'ffffecdf ? ? ts1 ts0 tm ie te de h'ffffece0 sar2 dmac h'ffffece1 (channel 2) h'ffffece2 h'ffffece3 h'ffffece4 dar2 h'ffffece5 h'ffffece6 h'ffffece7 h'ffffece8 dmatcr2 ? ? ? ? ? ? ? ? h'ffffece9 h'ffffecea h'ffffeceb
858 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffecec chcr2 ? ? ? ? ? ? ? ro dmac h'ffffeced ? ? ? rs4 rs3 rs2 rs1 rs0 (channel 2) h'ffffecee ? ? sm1 sm0 ? ? dm1 dm0 h'ffffecef ? ? ts1 ts0 tm ie te de h'ffffecf0 sar3 dmac h'ffffecf1 (channel 3) h'ffffecf2 h'ffffecf3 h'ffffecf4 dar3 h'ffffecf5 h'ffffecf6 h'ffffecf7 h'ffffecf8 dmatcr3 ? ? ? ? ? ? ? ? h'ffffecf9 h'ffffecfa h'ffffecfb h'ffffecfc chcr3 ? ? ? di ? ? ? ? h'ffffecfd ? ? ? rs4 rs3 rs2 rs1 rs0 h'ffffecfe ? ? sm1 sm0 ? ? dm1 dm0 h'ffffecff ? ? ts1 ts0 tm ie te de h'ffffed00 ipra intc h'ffffed01 h'ffffed02 to h'ffffed03 ? ? ?? ?? ?? ? h'ffffed04 iprc h'ffffed05 h'ffffed06 iprd h'ffffed07 h'ffffed08 ipre h'ffffed09
859 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'ffffed0a iprf intc h'ffffed0b h'ffffed0c iprg h'ffffed0d h'ffffed0e iprh h'ffffed0f h'ffffed10 ipri h'ffffed11 h'ffffed12 iprj h'ffffed13 h'ffffed14 iprk h'ffffed15 h'ffffed16 iprl h'ffffed17 h'ffffed18 icr nmil ? ? ? ? ? ? nmie h'ffffed19 irq0s irq1s irq2s irq3s ? ? ? ? h'ffffed1a isr ? ? ? ? ? ? ? ? h'ffffed1b irq0f irq1f irq2f irq3f ? ? ? ? h'ffffed1c to h'ffffefff ? ? ?? ?? ?? ?? h'fffff000 smr0 c/ a e
860 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff008 smr1 c/ a e a e a e a e
861 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff027 to h'fffff3ff ? ? ?? ?? ?? ?? h'fffff400 tstr2 str7d str7c str7b str7a str6d str6c str6b str6a atu-ii h'fffff401 tstr1 str10 str5 str4 str3 s tr1 b , 2 b str2a str1a str0 (common) h'fffff402 tstr3 ? ? ? ? ? ? ? str11 h'fffff403 ? ? ? ? ? ? ? ? ? h'fffff404 pscr1 ? ? ? psc1e psc1d psc1c psc1b psc1a h'fffff405 ? ? ? ? ? ? ? ? ? h'fffff406 pscr2 psc2e psc2d psc2c psc2b psc2a h'fffff407 ? ? ? ? ? ? ? ? ? h'fffff408 pscr3 ? ? ? psc3e psc3d psc3c psc3b psc3a h'fffff409 ? ? ? ? ? ? ? ? ? h'fffff40a pscr4 ? ? ? psc4e psc4d psc4c psc4b psc4a h'fffff40b ? ? ? ? ? ? ? ? ? h'fffff40c to h'fffff41f ? ? ?? ?? ?? ?? h'fffff420 icr0dh atu-ii h'fffff421 (channel 0) h'fffff422 icr0dl h'fffff423 h'fffff424 itvrr1 ? ? ? ? itve9 itve8 itve7 itve6 h'fffff425 h'fffff426 itvrr2a itva13a itva12a itva11a itva10a itve13a itve12a itve11a itve10a h'fffff427 ? ? ? ? ? ? ? ? ? h'fffff428 itvrr2b itva13b itva12b itva11b itva10b itve13b itve12b itve11b itve10b h'fffff429 ? ? ? ? ? ? ? ? ? h'fffff42a tior0 io0d1 io0d0 io0c1 io0c0 io0b1 io0b0 io0a1 io0a0 h'fffff42b ? ? ? ? ? ? ? ? ? h'fffff42c tsr0 ? ? ? ? ? ? ? ? h'fffff42d iif2b iif2a iif1 ovf0 icf0d icf0c icf0b icf0a
862 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff42e tier0 ? ? ? ? ? ? ? ? atu-ii h'fffff42f ? ? ? ove0 ice0d ice0c ice0b ice0a (channel 0) h'fffff430 tcnt0h h'fffff431 h'fffff432 tcnt0l h'fffff433 h'fffff434 icr0ah h'fffff435 h'fffff436 icr0al h'fffff437 h'fffff438 icr0bh h'fffff439 h'fffff43a icr0bl h'fffff43b h'fffff43c icr0ch h'fffff43d h'fffff43e icr0cl h'fffff43f h'fffff440 tcnt1a atu-ii h'fffff441 (channel 1) h'fffff442 tcnt1b h'fffff443 h'fffff444 gr1a h'fffff445 h'fffff446 gr1b h'fffff447 h'fffff448 gr1c h'fffff449 h'fffff44a gr1d h'fffff44b
863 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff44c gr1e atu-ii h'fffff44d (channel 1) h'fffff44e gr1f h'fffff44f h'fffff450 gr1g h'fffff451 h'fffff452 gr1h h'fffff453 h'fffff454 ocr1 h'fffff455 h'fffff456 osbr1 h'fffff457 h'fffff458 tior1b ? io1d2 io1d1 io1d0 ? io1c2 io1c1 io1c0 h'fffff459 tior1a ? io1b2 io1b1 io1b0 ? io1a2 io1a1 io1a0 h'fffff45a tior1d ? io1h2 io1h1 io1h0 ? io1g2 io1g1 io1g0 h'fffff45b tior1c ? io1f2 io1f1 io1f0 ? io1e2 io1e1 io1e0 h'fffff45c tcr1b ? ? ckegb1 ckegb0 ckselb3 ckselb2 ckselb1 ckselb0 h'fffff45d tcr1a ? ? ckega1 ckega0 cksela3 cksela2 cksela1 cksela0 h'fffff45e tsr1a ? ? ? ? ? ? ? ovf1a h'fffff45f imf1h imf1g imf1f imf1e imf1d imf1c imf1b imf1a h'fffff460 tsr1b ? ? ? ? ? ? ? ovf1b h'fffff461 ? ? ? ? ? ? ? cmf1 h'fffff462 tier1a ? ? ? ? ? ? ? ove1a h'fffff463 ime1h ime1g ime1f ime1e ime1d ime1c ime1b ime1a h'fffff464 tier1b ? ? ? ? ? ? ? ove1b h'fffff465 ? ? ? ? ? ? ? cme1 h'fffff466 trgmdr trgmd ? ? ? ? ? ? ? h'fffff467 to h'fffff47f ? ? ?? ?? ?? ??
864 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff480 tsr3 ? ovf5 imf5d imf5c imf5b imf5a ovf4 imf4d atu-ii h'fffff481 imf4c imf4b imf4a ovf3 imf3d imf3c imf3b imf3a (common in channels 3, 4, and 5) h'fffff482 tier3 ? ove5 ime5d ime5c ime5b ime5a ove4 ime4d h'fffff483 ime4c ime4b ime4a ove3 ime3d ime3c ime3b ime3a h'fffff484 tmdr ? ? ? ? ? t5pwm t4pwm t3pwm h'fffff485 to h'fffff49f ? ? ?? ?? ?? ?? h'fffff4a0 tcnt3 atu-ii h'fffff4a1 (channel 3) h'fffff4a2 gr3a h'fffff4a3 h'fffff4a4 gr3b h'fffff4a5 h'fffff4a6 gr3c h'fffff4a7 h'fffff4a8 gr3d h'fffff4a9 h'fffff4aa tior3b cci3d io3d2 io3d1 io3d0 cci3c io3c2 io3c1 io3c0 h'fffff4ab tior3a cci3b io3b2 io3b1 io3b0 cci3a io3a2 io3a1 io3a0 h'fffff4ac tcr3 ? ? ckeg1 ckeg0 cksel3 cksel2 cksel1 cksel0 h'fffff4ad to h'fffff4bf ? ? ?? ?? ?? ?? h'fffff4c0 tcnt4 atu-ii h'fffff4c1 (channel 4) h'fffff4c2 gr4a h'fffff4c3 h'fffff4c4 gr4b h'fffff4c5
865 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff4c6 gr4c atu-ii h'fffff4c7 (channel 4) h'fffff4c8 gr4d h'fffff4c9 h'fffff4ca tior4b cci4d io4d2 io4d1 io4d0 cci4c io4c2 io4c1 io4c0 h'fffff4cb tior4a cci4b io4b2 io4b1 io4b0 cci4a io4a2 io4a1 io4a0 h'fffff4cc tcr4 ? ? ckeg1 ckeg0 cksel3 cksel2 cksel1 cksel0 h'fffff4cd to h'fffff4df ? ? ?? ?? ?? ?? h'fffff4e0 tcnt5 atu-ii h'fffff4e1 (channel 5) h'fffff4e2 gr5a h'fffff4e3 h'fffff4e4 gr5b h'fffff4e5 h'fffff4e6 gr5c h'fffff4e7 h'fffff4e8 gr5d h'fffff4e9 h'fffff4ea tior5b cci5d io5d2 io5d1 io5d0 cci5c io5c2 io5c1 io5c0 h'fffff4eb tior5a cci5b io5b2 io5b1 io5b0 cci5a io5a2 io5a1 io5a0 h'fffff4ec tcr5 ? ? ckeg1 ckeg0 cksel3 cksel2 cksel1 cksel0 h'fffff4ed to h'fffff4ef ? ? ?? ?? ?? ?? h'fffff500 tcnt6a atu-ii h'fffff501 (channel 6) h'fffff502 tcnt6b h'fffff503 h'fffff504 tcnt6c h'fffff505
866 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff506 tcnt6d atu-ii h'fffff507 (channel 6) h'fffff508 cylr6a h'fffff509 h'fffff50a cylr6b h'fffff50b h'fffff50c cylr6c h'fffff50d h'fffff50e cylr6d h'fffff50f h'fffff510 bfr6a h'fffff511 h'fffff512 bfr6b h'fffff513 h'fffff514 bfr6c h'fffff515 h'fffff516 bfr6d h'fffff517 h'fffff518 dtr6a h'fffff519 h'fffff51a dtr6b h'fffff51b h'fffff51c dtr6c h'fffff51d h'fffff51e dtr6d h'fffff51f h'fffff520 tcr6b ? ckseld2 ckseld1 ckseld0 ? ckselc2 ckselc1 ckselc0 h'fffff521 tcr6a ? ckselb2 ckselb1 ckselb0 ? cksela2 cksela1 cksela0 h'fffff522 tsr6 ? ? ? ? ? ? ? ? h'fffff523 ud6d ud6c ud6b ud6a cmf6d cmf6c cmf6b cmf6a
867 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff524 tier6 ? ? ? ? ? ? ? ? atu-ii h'fffff525 ? ? ? ? cme6d cme6c cme6b cme6a (channel 6) h'fffff526 pmdr dtseld dtselc dtselb dtsela cntseld cntselc cntselb cntsela h'fffff527 to h'fffff57f ? ? ?? ?? ?? ?? h'fffff580 tcnt7a atu-ii h'fffff581 (channel 7) h'fffff582 tcnt7b h'fffff583 h'fffff584 tcnt7c h'fffff585 h'fffff586 tcnt7d h'fffff587 h'fffff588 cylr7a h'fffff589 h'fffff58a cylr7b h'fffff58b h'fffff58c cylr7c h'fffff58d h'fffff58e cylr7d h'fffff58f h'fffff590 bfr7a h'fffff591 h'fffff592 bfr7b h'fffff593 h'fffff594 bfr7c h'fffff595 h'fffff596 bfr7d h'fffff597
868 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff598 dtr7a atu-ii h'fffff599 (channel 7) h'fffff59a dtr7b h'fffff59b h'fffff59c dtr7c h'fffff59d h'fffff59e dtr7d h'fffff59f h'fffff5a0 tcr7b ? ckseld2 ckseld1 ckseld0 ? ckselc2 ckselc1 ckselc0 h'fffff5a1 tcr7a ? ckselb2 ckselb1 ckselb0 ? cksela2 cksela1 cksela0 h'fffff5a2 tsr7 ? ? ? ? ? ? ? ? h'fffff5a3 ? ? ? ? cmf7d cmf7c cmf7b cmf7a h'fffff5a4 tier7 ? ? ? ? ? ? ? ? h'fffff5a5 ? ? ? ? cme7d cme7c cme7b cme7a h'fffff5a6 to h'fffff5bf ? ? ?? ?? ?? ?? h'fffff5c0 tcnt11 atu-ii h'fffff5c1 (channel 11) h'fffff5c2 gr11a h'fffff5c3 h'fffff5c4 gr11b h'fffff5c5 h'fffff5c6 tior11 ? ? ? io11b0 ? ? ? io11a0 h'fffff5c7 ? ? ? ? ? ? ? ? ? h'fffff5c8 tcr11 ? ? ckeg1 ckeg0 ? cksela2 cksela1 cksela0 h'fffff5c9 ? ? ? ? ? ? ? ? ? h'fffff5ca tsr11 ? ? ? ? ? ? ? ovf11 h'fffff5cb ? ? ? ? ? ? imf11b imf11a h'fffff5cc tier11 ? ? ? ? ? ? ? ove11 h'fffff5cd ? ? ? ? ? ? ime11b ime11a
869 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff5ce to h'fffff5ff ? ? ?? ?? ?? ?? h'fffff600 tcnt2a atu-ii h'fffff601 (channel 2) h'fffff602 tcnt2b h'fffff603 h'fffff604 gr2a h'fffff605 h'fffff606 gr2b h'fffff607 h'fffff608 gr2c h'fffff609 h'fffff60a gr2d h'fffff60b h'fffff60c gr2e h'fffff60d h'fffff60e gr2f h'fffff60f h'fffff610 gr2g h'fffff611 h'fffff612 gr2h h'fffff613 h'fffff614 ocr2a h'fffff615 h'fffff616 ocr2b h'fffff617 h'fffff618 ocr2c h'fffff619 h'fffff61a ocr2d h'fffff61b
870 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff61c ocr2e atu-ii h'fffff61d (channel 2) h'fffff61e ocr2f h'fffff61f h'fffff620 ocr2g h'fffff621 h'fffff622 ocr2h h'fffff623 h'fffff624 osbr2 h'fffff625 h'fffff626 tior2b ? io2d2 io2d1 io2d0 ? io2c2 io2c1 io2c0 h'fffff627 tior2a ? io2b2 io2b1 io2b0 ? io2a2 io2a1 io2a0 h'fffff628 tior2d ? io2h2 io2h1 io2h0 ? io2g2 io2g1 io2g0 h'fffff629 tior2c ? io2f2 io2f1 io2f0 ? io2e2 io2e1 io2e0 h'fffff62a tcr2b ? ? ckegb1 ckegb0 ckselb3 ckselb2 ckselb1 ckselb0 h'fffff62b tcr2a ? ? ckega1 ckega0 cksela3 cksela2 cksela1 cksela0 h'fffff62c tsr2a ? ? ? ? ? ? ? ovf2a h'fffff62d imf2h imf2g imf2f imf2e imf2d imf2c imf2b imf2a h'fffff62e tsr2b ? ? ? ? ? ? ? ovf2b h'fffff62f cmf2h cmf2g cmf2f cmf2e cmf2d cmf2c cmf2b cmf2a h'fffff630 tier2a ? ? ? ? ? ? ? ove1a h'fffff631 ime2h ime2g ime2f ime2e ime2d ime2c ime2b ime2a h'fffff632 tier2b ? ? ? ? ? ? ? ove2b h'fffff633 cme2h cme2g cme2f cme2e cme2d cme2c cme2b cme2a h'fffff634 to h'fffff63f ? ? ?? ?? ?? ?? h'fffff640 dcnt8a atu-ii h'fffff641 (channel 8) h'fffff642 dnct8b h'fffff643
871 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff644 dnct8c atu-ii h'fffff645 (channel 8) h'fffff646 dcnt8d h'fffff647 h'fffff648 dcnt8e h'fffff649 h'fffff64a dcnt8f h'fffff64b h'fffff64c dcnt8g h'fffff64d h'fffff64e dcnt8h h'fffff64f h'fffff650 dcnt8i h'fffff651 h'fffff652 dcnt8j h'fffff653 h'fffff654 dcnt8k h'fffff655 h'fffff656 dcnt8l h'fffff657 h'fffff658 dcnt8m h'fffff659 h'fffff65a dcnt8n h'fffff65b h'fffff65c dcnt8o h'fffff65d h'fffff65e dcnt8p h'fffff65f h'fffff660 rldr8 h'fffff661
872 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff662 tcnr cn8p cn8o cn8n cn8m cn8l cn8k cn8j cn8i atu-ii h'fffff663 cn8h cn8g cn8f cn8e cn8d cn8c cn8b cn8a (channel 8) h'fffff664 otr otep oteo oten otem otel otek otej otei h'fffff665 oteh oteg otef otee oted otec oteb otea h'fffff666 dstr dst8p dst8o dst8n dst8m dst8l dst8k dst8j dst8i h'fffff667 dst8h dst8g dst8f dst8e dst8d dst8c dst8b dst8a h'fffff668 tcr8 ? ckselb2 ckselb1 ckselb0 ? cksela2 cksela1 cksela0 h'fffff669 ? ? ? ? ? ? ? ? ? h'fffff66a tsr8 osf8p osf8o osf8n osf8m osf8l osf8k osf8j osf8i h'fffff66b osf8h osf8g osf8f osf8e osf8d osf8c osf8b osf8a h'fffff66c tier8 ose8p ose8o ose8n ose8m ose8l ose8k ose8j ose8i h'fffff66d ose8h ose8g ose8f ose8e ose8d ose8c ose8b ose8a h'fffff66e rldenr rlden ? ? ? ? ? ? ? h'fffff66f to h'fffff67f ? ? ?? ?? ?? ?? h'fffff680 ecnt9a atu-ii h'fffff681 ? ? ? ? ? ? ? ? ? (channel 9) h'fffff682 ecnt9b h'fffff683 ? ? ? ? ? ? ? ? ? h'fffff684 ecnt9c h'fffff685 ? ? ? ? ? ? ? ? ? h'fffff686 ecnt9d h'fffff687 ? ? ? ? ? ? ? ? ? h'fffff688 ecnt9e h'fffff689 ? ? ? ? ? ? ? ? ? h'fffff68a ecnt9f h'fffff68b ? ? ? ? ? ? ? ? ? h'fffff68c gr9a h'fffff68d ? ? ? ? ? ? ? ? ? h'fffff68e gr9b
873 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff68f ? ? ? ? ? ? ? ? ? atu-ii h'fffff690 gr9c (channel 9) h'fffff691 ? ? ? ? ? ? ? ? ? h'fffff692 gr9d h'fffff693 ? ? ? ? ? ? ? ? ? h'fffff694 gr9e h'fffff695 ? ? ? ? ? ? ? ? ? h'fffff696 gr9f h'fffff697 ? ? ? ? ? ? ? ? ? h'fffff698 tcr9a ? trg3ben egselb1 egselb0 ? trg3aen egsela1 egsela0 h'fffff699 ? ? ? ? ? ? ? ? ? h'fffff69a tcr9b ? trg3denegseld1 egseld0 ? trg3cenegselc1 egselc0 h'fffff69b ? ? ? ? ? ? ? ? ? h'fffff69c tcr9c ? ? egself1 egself0 ? ? egsele1 egsele0 h'fffff69d ? ? ? ? ? ? ? ? ? h'fffff69e tsr9 ? ? ? ? ? ? ? ? h'fffff69f ? ? cmf9f cmf9e cmf9d cmf9c cmf9b cmf9a h'fffff6a0 tier9 ? ? ? ? ? ? ? ? h'fffff6a1 ? ? cme9f cme9e cme9d cme9c cme9b cme9a h'fffff6a2 to h'fffff6bf ? ? ?? ?? ?? ?? h'fffff6c0 tcnt10ah atu-ii h'fffff6c1 (channel 10) h'fffff6c2 tcnt10al h'fffff6c3 h'fffff6c4 tcnt10b h'fffff6c5 ? ? ? ? ? ? ? ? ? h'fffff6c6 tcnt10c h'fffff6c7
874 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff6c8 tcnt10d atu-ii h'fffff6c9 ? ? ? ? ? ? ? ? ? (channel 10) h'fffff6ca tcnt10e h'fffff6cb h'fffff6cc tcnt10f h'fffff6cd h'fffff6ce tcnt10g h'fffff6cf h'fffff6d0 icr10ah h'fffff6d1 h'fffff6d2 icr10al h'fffff6d3 h'fffff6d4 ocr10ah h'fffff6d5 h'fffff6d6 ocr10al h'fffff6d7 h'fffff6d8 ocr10b h'fffff6d9 ? ? ? ? ? ? ? ? ? h'fffff6da rld10c h'fffff6db h'fffff6dc gr10g h'fffff6dd h'fffff6de tcnt10h h'fffff6df ? ? ? ? ? ? ? ? ? h'fffff6e0 ncr10 h'fffff6e1 ? ? ? ? ? ? ? ? ? h'fffff6e2 tior10 rlden ccs pim1 pim0 ? io10g2 io10g1 io10g0 h'fffff6e3 ? ? ? ? ? ? ? ? ? h'fffff6e4 tcr10 trg2ben trg1ben trg2aen trg1aen trg0den nce ckeg1 ckeg0 h'fffff6e5 ? ? ? ? ? ? ? ? ?
875 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff6e6 tcclr10 atu-ii h'fffff6e7 (channel 10) h'fffff6e8 tsr10 ? ? ? ? ? ? ? ? h'fffff6e9 ? ? ? ? cmf10g cmf10b icf10a cmf10a h'fffff6ea tier10 ? ? ? ? ? ? ? ? h'fffff6eb ? ? ? ireg cme10g cme10b ice10a cme10a h'fffff6ec to h'fffff6ff ? ? ?? ?? ?? ?? h'fffff700 popcr puls7 roe puls6 roe puls5 roe puls4 roe puls3 roe puls2 roe puls1 roe puls0 roe apc h'fffff701 puls7 soe puls6 soe puls5 soe puls4 soe puls3 soe puls2 soe puls1 soe puls0 soe h'fffff702 to h'fffff707 ? ? ?? ?? ?? ?? h'fffff708 syscr ? ? ? ? ? ? audsrst rame power-down h'fffff709 ? ? ? ? ? ? ? ? ? mode h'fffff70a ? ? ? ? ? ? ? ? ? h'fffff70b mstcr * 3 ? ? ? ? mstop3 ? ? mstop0 h'fffff70c to h'fffff70f ? ? ?? ?? ?? ?? h'fffff710 cmstr ? ? ? ? ? ? ? ? cmt h'fffff711 ? ? ? ? ? ? str1 str0 h'fffff712 cmcsr0 ? ? ? ? ? ? ? ? h'fffff713 cmf cmie ? ? ? ? cks1 cks0 h'fffff714 cmcnt0 h'fffff715 h'fffff716 cmcor0 h'fffff717 note: 3. this is the read address. the write address is h'fffff70a. for details, see section 23.2.4, notes on register access.
876 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff718 cmcsr1 ? ? ? ? ? ? ? ? cmt h'fffff719 cmf cmie ? ? ? ? cks1 cks0 h'fffff71a cmcnt1 h'fffff71b h'fffff71c cmcor1 h'fffff71d h'fffff71e ? ? ? ? ? ? ? ? ? h'fffff71f ? ? ? ? ? ? ? ? ? h'fffff720 paior pa15ior pa14ior pa13ior pa12ior pa11ior pa10ior pa9ior pa8ior port a h'fffff721 pa7ior pa6ior pa5ior pa4ior pa3ior pa2ior pa1ior pa0ior h'fffff722 pacrh ? pa15md ? pa14md ? pa13md ? pa12md h'fffff723 ? pa11md ? pa10md ? pa9md ? pa8md h'fffff724 pacrl ? pa7md ? pa6md ? pa5md ? pa4md h'fffff725 ? pa3md ? pa2md ? pa1md ? pa0md h'fffff726 padr pa15dr pa14dr pa13dr pa12dr pa11dr pa10dr pa9dr pa8dr h'fffff727 pa7dr pa6dr pa5dr pa4dr pa3dr pa2dr pa1dr pa0dr h'fffff728 phior ph15ior ph14ior ph13ior ph12ior ph11ior ph10ior ph9ior ph8ior port h h'fffff729 ph7ior ph6ior ph5ior ph4ior ph3ior ph2ior ph1ior ph0ior h'fffff72a phcr ph15md ph14md ph13md ph12md ph11md ph10md ph9md ph8md h'fffff72b ph7md ph6md ph5md ph4md ph3md ph2md ph1md ph0md h'fffff72c phdr ph15dr ph14dr ph13dr ph12dr ph11dr ph10dr ph9dr ph8dr h'fffff72d ph7dr ph6dr ph5dr ph4dr ph3dr ph2dr ph1dr ph0dr h'fffff72e adtrgr1 extrg ? ? ? ? ? ? ? a/d h'fffff72f ? ? ? ? ? ? ? ? ? ? h'fffff730 pbior pb15ior pb14ior pb13ior pb12ior pb11ior pb10ior pb9ior pb8ior port b h'fffff731 pb7ior pb6ior pb5ior pb4ior pb3ior pb2ior pb1ior pb0ior h'fffff732 pbcrh pb15md1 pb15md0 pb14md1 pb14md0 ? pb13md pb12md1 pb12md0 h'fffff733 pb11md1 pb11md0 pb10md1 pb10md0 pb9md1 pb9md0 pb8md1 pb8md0 h'fffff734 pbcrl pb7md1 pb7md0 pb6md1 pb6md0 pb5md1 pb5md0 pb4md1 pb4md0 h'fffff735 ? pb3md ? pb2md ? pb1md ? pb0md
877 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff736 pbir pb15ir pb14ir pb13ir ? pb11ir pb10ir pb9ir pb8ir port b h'fffff737 pb7ir pb6ir pb5ir pb4ir pb3ir pb2ir pb1ir pb0ir h'fffff738 pbdr pb15dr pb14dr pb13dr pb12dr pb11dr pb10dr pb9dr pb8dr h'fffff739 pb7dr pb6dr pb5dr pb4dr pb3dr pb2dr pb1dr pb0dr h'fffff73a pcior ? ? ? ? ? ? ? ? port c h'fffff73b ? ? ? pc4ior pc3ior pc2ior pc1ior pc0ior h'fffff73c pccr ? ? ? ? ? ? ? pc4md h'fffff73d ? pc3md ? pc2md ? pc1md ? pc0md h'fffff73e pcdr ? ? ? ? ? ? ? ? h'fffff73f ? ? ? pc4dr pc3dr pc2dr pc1dr pc0dr h'fffff740 pdior ? ? pd13ior pd12ior pd11ior pd10ior pd9ior pd8ior port d h'fffff741 pd7ior pd6ior pd5ior pd4ior pd3ior pd2ior pd1ior pd0ior h'fffff742 pdcrh ? ? ? ? pd13md1 pd13md0 ? pd12md h'fffff743 ? pd11md ? pd10md ? pd9md ? pd8md h'fffff744 pdcrl ? pd7md ? pd6md ? pd5md ? pd4md h'fffff745 ? pd3md ? pd2md ? pd1md ? pd0md h'fffff746 pddr ? ? pd13dr pd12dr pd11dr pd10dr pd9dr pd8dr h'fffff747 pddr pd7dr pd6dr pd5dr pd4dr pd3dr pd2dr pd1dr pd0dr h'fffff748 pfior pf15ior pf14ior pf13ior pf12ior pf11ior pf10ior pf9ior pf8ior port f h'fffff749 pf7ior pf6ior pf5ior pf4ior pf3ior pf2ior pf1ior pf0ior h'fffff74a pfcrh ckhiz pf15md ? pf14md ? pf13md ? pf12md h'fffff74b ? pf11md ? pf10md ? pf9md ? pf8md h'fffff74c pfcrl ? pf7md ? pf6md pf5md1 pf5md0 ? pf4md h'fffff74d ? pf3md ? pf2md ? pf1md ? pf0md h'fffff74e pfdr pf15dr pf14dr pf13dr pf12dr pf11dr pf10dr pf9dr pf8dr h'fffff74f pf7dr pf6dr pf5dr pf4dr pf3dr pf2dr pf1dr pf0dr h'fffff750 peior pe15ior pe14ior pe13ior pe12ior pe11ior pe10ior pe9ior pe8ior port e h'fffff751 pe7ior pe6ior pe5ior pe4ior pe3ior pe2ior pe1ior pe0ior h'fffff752 pecr pe15md pe14md pe13md pe12md pe11md pe10md pe9md pe8md h'fffff753 pe7md pe6md pe5md pe4md pe3md pe2md pe1md pe0md
878 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff754 pedr pe15dr pe14dr pe13dr pe12dr pe11dr pe10dr pe9dr pe8dr port e h'fffff755 pe7dr pe6dr pe5dr pe4dr pe3dr pe2dr pe1dr pe0dr h'fffff756 to h'fffff75f ? ? ?? ?? ?? ?? h'fffff760 pgior ? ? ? ? ? ? ? ? port g h'fffff761 ? ? ? ? pg3ior pg2ior pg1ior pg0ior h'fffff762 pgcr ? ? ? ? ? ? ? ? h'fffff763 pg3md1 pg3md0 pg2md1 pg2md0 ? pg1md pg0md1 pg0md0 h'fffff764 pgdr ? ? ? ? ? ? ? ? h'fffff765 ? ? ? ? pg3dr pg2dr pg1dr pg0dr h'fffff766 pjior pj15ior pj14ior pj13ior pj12ior pj11ior pj10ior pj9ior pj8ior port j h'fffff767 pj7ior pj6ior pj5ior pj4ior pj3ior pj2ior pj1ior pj0ior h'fffff768 pjcrh ? pj15md ? pj14md ? pj13md ? pj12md h'fffff769 ? pj11md ? pj10md ? pj9md ? pj8md h'fffff76a pjcrl ? pj7md ? pj6md ? pj5md ? pj4md h'fffff76b ? pj3md ? pj2md ? pj1md ? pj0md h'fffff76c pjdr pj15dr pj14dr pj13dr pj12dr pj11dr pj10dr pj9dr pj8dr h'fffff76d pj7dr pj6dr pj5dr pj4dr pj3dr pj2dr pj1dr pj0dr h'fffff76e adtrgr0 extrg ? ? ? ? ? ? ? a/d h'fffff76f ? ? ? ? ? ? ? ? ? h'fffff770 pkior pk15ior pk14ior pk13ior pk12ior pk11ior pk10ior pk9ior pk8ior port k h'fffff771 pk7ior pk6ior pk5ior pk4ior pk3ior pk2ior pk1ior pk0ior h'fffff772 pkcrh ? pk15md ? pk14md ? pk13md ? pk12md h'fffff773 ? pk11md ? pk10md ? pk9md ? pk8md h'fffff774 pkcrl ? pk7md ? pk6md ? pk5md ? pk4md h'fffff775 ? pk3md ? pk2md ? pk1md ? pk0md h'fffff776 pkir pk15ir pk14ir pk13ir pk12ir pk11ir pk10ir pk9ir pk8ir h'fffff777 pk7ir pk6ir pk5ir pk4ir pk3ir pk2ir pk1ir pk0ir h'fffff778 pkdr pk15dr pk14dr pk13dr pk12dr pk11dr pk10dr pk9dr pk8dr h'fffff779 pkdr pk7dr pk6dr pk5dr pk4dr pk3dr pk2dr pk1dr pk0dr
879 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff77a to h'fffff7ff ? ? ?? ?? ?? ?? h'fffff800 addr0h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d h'fffff801 addr0l ad1 ad0 ? ? ? ? ? ? h'fffff802 addr1h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff803 addr1l ad1 ad0 ? ? ? ? ? ? h'fffff804 addr2h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff805 addr2l ad1 ad0 ? ? ? ? ? ? h'fffff806 addr3h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff807 addr3l ad1 ad0 ? ? ? ? ? ? h'fffff808 addr4h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff809 addr4l ad1 ad0 ? ? ? ? ? ? h'fffff80a addr5h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff80b addr5l ad1 ad0 ? ? ? ? ? ? h'fffff80c addr6h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff80d addr6l ad1 ad0 ? ? ? ? ? ? h'fffff80e addr7h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff80f addr7l ad1 ad0 ? ? ? ? ? ? h'fffff810 addr8h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff811 addr8l ad1 ad0 ? ? ? ? ? ? h'fffff812 addr9h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff813 addr9l ad1 ad0 ? ? ? ? ? ? h'fffff814 addr10h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff815 addr10l ad1 ad0 ? ? ? ? ? ? h'fffff816 addr11h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff817 addr11l ad1 ad0 ? ? ? ? ? ? h'fffff818 adcsr0 adf adie adm1 adm0 ch3 ch2 ch1 ch0 h'fffff819 adcr0 trge cks adst adcs ? ? ? ? h'fffff81a to h'fffff81f ? ? ?? ?? ?? ?
880 table a.1 address (cont) register bit names address abbr. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module h'fffff820 addr12h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d h'fffff821 addr12l ad1 ad0 ? ? ? ? ? ? h'fffff822 addr13h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff823 addr13l ad1 ad0 ? ? ? ? ? ? h'fffff824 addr14h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff825 addr14l ad1 ad0 ? ? ? ? ? ? h'fffff826 addr15h ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 h'fffff827 addr15l ad1 ad0 ? ? ? ? ? ? port k h'fffff828 to h'fffff837 ? ? ?? ?? ?? ?? h'fffff838 adcsr1 adf adie adm1 adm0 ch3 ch2 ch1 ch0 a/d h'fffff839 adcr1 trge cks adst adcs ? ? ? ? h'fffff83a to h'fffff85f ? ? ?? ?? ?? ??
881 a.2 register states in reset and power-down states table a.2 register states in reset and power-down states reset state power-down state type name power-on hardware standby software standby sleep cpu r0 to r15 initialized initialized held held sr gbr vbr mach, macl pr pc interrupt controller ipra, iprc to iprl initialized initialized held held (intc) ior isr user break controller ubarh, ubarl initialized initialized held held (ubc) ubamrh, ubamrl ubbr ubcr bus state controller bcr1, bcr2 initialized initialized held held (bsc) wcr direct memory access sar0 to sar3 undefined undefined undefined held controller (dmac) dar0 to dar3 dmatcr0 to dmatcr3 chcr0 to chcr3 initialized initialized initialized dmaor advanced timer unit-ii (atu-ii) bfr6a to bfr6d, bfr7a to bfr7d initialized initialized initialized held cylr6a to cylr6d, cylr7a to cylr7d dcnt8a to dcnt8p dstr
882 table a.2 register states in reset and power-down states (cont) reset state power-down state type name power-on hardware standby software standby sleep advanced timer unit-ii (atu-ii) dtr6a to dtr6d, dtr7a to dtr7d initialized initialized initialized held ecnt9a to ecnt9f gr1a to gr1h, gr2a to gr2h, gr3a to gr3d, gr4a to gr4d, gr5a to gr5d, gr9a to gr9f, gr10g, gr11a, gr11b icr0a to icr0d, icr10a itvrr1, itvrr2a, itvrr2b ncr10 ocr1, ocr2a to ocr2h, ocr10ah, ocr10al, ocr10b osbr1, osbr2 otr pmdr pscr1 to pscr4 pstr rld10c rldenr rldr8 tcclr10 tcnr
883 table a.2 register states in reset and power-down states (cont) reset state power-down state type name power-on hardware standby software standby sleep advanced timer unit-ii (atu-ii) tcnt0h, tcnt0l, tcnt1a, tcnt1b, tcnt2a, tcnt2b, tcnt3 to tcnt5, tcnt6a to tcnt6d, tcnt7a to tcnt7d, tcnt10ah, tcnt10al, tcnt10b to tcnt10h, tcnt11 initialized initialized initialized held tcr1a, tcr1b, tcr2a, tcr2b, tcr3 to tcr5, tcr6a, tcr6b, tcr7a, tcr7b, tcr8, tcr9a to tcr9c, tcr10, tcr11 tier0, tier1a, tier1b, tier2a, tier2b, tier3, tier6 to tier11 tior0, tior1a to tior1d, tior2a to tior2d, tior3a, tior3b, tior4a, tior4b, tior5a, tior5b, tior10, tior11 tmdr tnct10e trgmdr tsr0, tsr1a, tsr1b, tsr2a, tsr2b, tsr3, tsr6 to tsr11 tstr1 to tstr3 advanced pulse controller (apc) popcr initialized initialized held held
884 table a.2 register states in reset and power-down states (cont) reset state power-down state type name power-on hardware standby software standby sleep watchdog timer tcnt initialized initialized initialized held (wdt) tcsr * rstcsr initialized serial communication smr0 to smr4 initialized initialized held held interface (sci) brr0 to brr4 scr0 to scr4 tdr0 to tdr4 initialized ssr0 to ssr4 rdr0 to rdr4 sdcr0 to sdcr4 held a/d converter addr0(h/l) to addr15(h/l) initialized initialized initialized held adscr0, adcsr1 adcr0, adcr1 adtrgr held compare match timer cmstr initialized initialized initialized held (cmt) cmcsr0, cmcsr1 cmcnt0, cmcnt1 cmcor0, cmcor1 pin function controller (pfc) paior, pbior, pcior, pdior, peior, pfior, pgior, phior, pjior, pkior initialized initialized held held pacrh, pacrl, pbcrh, pbcrl, pbir, pccr, pdcrh, pdcrl, pecr, pfcrh, pfcrl, pgcr, phcr, pjcrh, pjcrl, pkcrh, pkcrl, pkir
885 table a.2 register states in reset and power-down states (cont) reset state power-down state type name power-on hardware standby software standby sleep i/o ports padr, pbdr, pcdr, pddr, pedr, pfdr, pgde, phdr, pjdr, pkdr initialized initialized held held flash rom flmcr1 initialized initialized initialized held flmcr2 initialized/ held ebr1, ebr2 initialized ramer held power-down modes sbycr initialized initialized held held syscr mstcr hitachi controller area mcr initialized initialized initialized held network (hcan) gsr bcr mbcr txpr txcr txack aback rxpr rfpr irr mbimr imr rec tec umsr lafml lafmh
886 table a.2 register states in reset and power-down states (cont) reset state power-down state type name power-on hardware standby software standby sleep hitachi controller area network (hcan) mc0 [ ] [ ] [ ] [ ] * bits 7 to 5 (ovf, wt/it, tme) are initialized, and bits 2 to 0 (cks2 to cks0) are held.
887 appendix b pin states tables b.1, b.2, and b.3 show the sh7052f/sh7053f/sh7054f pin states. table b.1 pin states (1) pin state reset state power-down state power-on type pin name romless expanded mode 8 bits 16 bits expanded mode with rom single- chip mode hardware standby software standby h-udi module standby aud module standby bus- released state clock ck * 2 ozh * 1 ooo xtal o z oooo extal i z iiii pllcap i iiiii system res hstby wdtovf * 1 ooo breq back irq0 irq3 wait wrh wrl rd cs0 cs1 cs3 pod * 1 i/o i/o i/o tio2a to tio2h ? z k * 1 i/o i/o i/o tio3a to tio3d ? z k * 1 i/o i/o i/o
888 table b.2 pin states (2) pin state reset state power-down state power-on type pin name romless expanded mode 8 bits 16 bits expanded mode with rom single- chip mode hardware standby software standby h-udi module standby aud module standby bus- released state atu tio4a to tio4d ? z k * 1 i/o i/o i/o tio5a to tio5d ? z k * 1 i/o i/o i/o to6a to to6d ? z o * 1 ooo to7a to to7d ? z o * 1 ooo to8a to to8p ? z o * 1 ooo ti9a to ti9f ? z z i i i ti10 ? z z i i i tclka, tclkb ? z z i i i sci sck0 to sck2 ? z k * 1 i/o i/o i/o txd0 to txd4 ? z o * 1 ooo rxd0 to rxd4 ? z z i i i a/d an0 to an15 z z z i i i converter adtrg0 * 1 ooo avref i iiiii apc puls0 to puls7 ? z o * 1 ooo hcan htxd ? z o * 1 ooo hrxd ? z z i i i ubc ubctrg * 1 oz o i/o pa0 to pa15 z z k * 1 i/o i/o i/o port pb0 to pb15 z z k * 1 i/o i/o i/o pc0 to pc4 z z k * 1 i/o i/o i/o pd0 to pd13 z z k * 1 i/o i/o i/o pe0 to pe15 ? z z k * 1 i/o i/o i/o pf0 to pf5 ? z z k * 1 i/o i/o i/o pf6 to pf10 ? z z k * 1 i/o i/o i/o ph11 to pf15 z z k * 1 i/o i/o i/o pg0 to pg3 z z k * 1 i/o i/o i/o ph0 to ph7 ? z z k * 1 i/o i/o i/o ph8 to ph15 z ? z z k * 1 i/o i/o i/o pj0 to pj15 z z k * 1 i/o i/o i/o pk0 to pk15 z z k * 1 i/o i/o i/o
889 table b.3 pin states (3) pin state type pin name hardware standby aud module standby aud reset ( audrst = l) software standby audsrst = 1 / normal operation no connection aud audrst audsync
890 appendix c product code lineup table c.1 sh7052f/sh7053f/sh7054f product code lineup product type product code mark code package sh7052 f-ztat version HD64F7052f40 HD64F7052f40 208-pin plastic qfp (fp-208a) sh7053 hd64f7053f40 hd64f7053f40 sh7054 hd64f7054f40 hd64f7054f40
891 appendix d package dimensions hitachi code jedec eiaj weight (reference value) fp-208a ? conforms 5.3 g unit: mm *dimension including the plating thickness base material dimension 30.6 0.2 30.6 0.2 0.5 3.56 max 0 e 8 *0.17 0.05 156 105 104 52 1 157 208 53 *0.22 0.05 0.10 m 0.10 3.20 0.5 0.1 1.3 28 0.15 +0.10 e 0.15 1.25 0.20 0.04 0.15 0.04 figure d.1 package dimensions (fp-208a)
892
sh7052 f-ztat tm , sh7053 f-ztat tm , sh7054 f-ztat tm hardware manual publication date: 1st edition, march 1999 3rd edition, november 2000 published by: electronic devices sales & marketing group semiconductor & integrated circuits hitachi, ltd. edited by: technical documentation group hitachi kodaira semiconductor co., ltd. copyright ? hitachi, ltd., 1999. all rights reserved. printed in japan.


▲Up To Search▲   

 
Price & Availability of HD64F7052

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X